mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Service: clarify Service.build arguments
First arg is config for the service we're instantiating. Second arg is service configurations so we can look up and configure other services by name.
This commit is contained in:
parent
f7f864c6f4
commit
1a17cfb9d9
2 changed files with 5 additions and 5 deletions
|
@ -39,8 +39,8 @@ class ActiveStorage::Service
|
|||
|
||||
# Override in subclasses that stitch together multiple services and hence
|
||||
# need to do additional lookups from configurations. See MirrorService.
|
||||
def self.build(config, configurations) #:nodoc:
|
||||
new(config)
|
||||
def self.build(service_config, all_configurations) #:nodoc:
|
||||
new(service_config)
|
||||
end
|
||||
|
||||
def upload(key, io, checksum: nil)
|
||||
|
|
|
@ -6,10 +6,10 @@ class ActiveStorage::Service::MirrorService < ActiveStorage::Service
|
|||
delegate :download, :exist?, :url, to: :primary
|
||||
|
||||
# Stitch together from named configuration.
|
||||
def self.build(mirror_config, all_configurations) #:nodoc:
|
||||
primary = ActiveStorage::Service.configure(mirror_config.fetch(:primary), all_configurations)
|
||||
def self.build(service_config, all_configurations) #:nodoc:
|
||||
primary = ActiveStorage::Service.configure(service_config.fetch(:primary), all_configurations)
|
||||
|
||||
mirrors = mirror_config.fetch(:mirrors).collect do |service_name|
|
||||
mirrors = service_config.fetch(:mirrors).collect do |service_name|
|
||||
ActiveStorage::Service.configure(service_name.to_sym, all_configurations)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue