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) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #set_config_file_path(config_file_path) ⇒ Object
Constructor Details
#initialize(configuration_validator, loader, credentials_provider) ⇒ Fetcher
Returns a new instance of Fetcher.
9 10 11 12 13 |
# File 'lib/bookbinder/config/fetcher.rb', line 9 def initialize(configuration_validator, loader, credentials_provider) @loader = loader @configuration_validator = configuration_validator @credentials_provider = credentials_provider end |
Instance Method Details
#fetch_config ⇒ Object
15 16 17 |
# File 'lib/bookbinder/config/fetcher.rb', line 15 def fetch_config @config ||= validate(read_config_file) end |
#fetch_credentials(environment = 'null-environment') ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bookbinder/config/fetcher.rb', line 19 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_file_path(config_file_path) ⇒ Object
32 33 34 |
# File 'lib/bookbinder/config/fetcher.rb', line 32 def set_config_file_path config_file_path @config_file_path = File. config_file_path end |