Class: Bookbinder::Config::Fetcher
- Inherits:
-
Object
- Object
- Bookbinder::Config::Fetcher
- Defined in:
- lib/bookbinder/config/fetcher.rb
Instance Method Summary collapse
- #fetch_config ⇒ Object
- #fetch_credentials(environment = 'null-environment') ⇒ Object
-
#initialize(configuration_validator, loader, credentials_provider, config_class) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #set_config_dir_path(config_dir_path) ⇒ Object
- #set_config_file_path(config_file_path) ⇒ Object
Constructor Details
#initialize(configuration_validator, loader, credentials_provider, config_class) ⇒ Fetcher
Returns a new instance of Fetcher.
9 10 11 12 13 14 |
# File 'lib/bookbinder/config/fetcher.rb', line 9 def initialize(configuration_validator, loader, credentials_provider, config_class) @loader = loader @configuration_validator = configuration_validator @credentials_provider = credentials_provider @config_class = config_class end |
Instance Method Details
#fetch_config ⇒ Object
16 17 18 19 20 21 |
# File 'lib/bookbinder/config/fetcher.rb', line 16 def fetch_config @base_config ||= read_config_file @optional_configs ||= read_optional_configs @config ||= validate(@base_config, @optional_configs) end |
#fetch_credentials(environment = 'null-environment') ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bookbinder/config/fetcher.rb', line 23 def fetch_credentials(environment = 'null-environment') @credentials ||= credentials_provider.credentials(fetch_config.cred_repo_url) { aws: Config::AwsCredentials.new( @credentials.fetch('aws', {}) ), cloud_foundry: Config::CfCredentials.new( @credentials.fetch('cloud_foundry', {}), environment ) } end |
#set_config_dir_path(config_dir_path) ⇒ Object
36 37 38 |
# File 'lib/bookbinder/config/fetcher.rb', line 36 def set_config_dir_path(config_dir_path) @config_dir_path = File.(config_dir_path) end |
#set_config_file_path(config_file_path) ⇒ Object
40 41 42 |
# File 'lib/bookbinder/config/fetcher.rb', line 40 def set_config_file_path(config_file_path) @config_file_path = File.(config_file_path) end |