Class: OnContainer::Secrets::UrlVariableProcessor
- Inherits:
-
Object
- Object
- OnContainer::Secrets::UrlVariableProcessor
- Includes:
- Common::SafePerformable
- Defined in:
- lib/on_container/secrets/url_variable_processor.rb
Overview
UrlVariableProcessor
For each *_URL environment variable where there’s also a *_(USER|USERNAME) or *_(PASS|PASSWORD), updates the URL environment variable with the given credentials. For example:
DATABASE_URL: postgres://postgres:5432/demo_production DATABASE_USERNAME: lalito DATABASE_PASSWORD: lepass
Results in the following updated DATABASE_URL:
DATABASE_URL = postgres://lalito:lepass@postgres:5432/demo_production
Instance Method Summary collapse
Methods included from Common::SafePerformable
Instance Method Details
#perform! ⇒ Object
22 23 24 25 |
# File 'lib/on_container/secrets/url_variable_processor.rb', line 22 def perform! require_uri_module if url_keys? process_credential_keys end |
#url_keys ⇒ Object
27 28 29 |
# File 'lib/on_container/secrets/url_variable_processor.rb', line 27 def url_keys @url_keys ||= ENV.keys.select { |key| key =~ /_URL/ } end |
#url_keys? ⇒ Boolean
31 32 33 |
# File 'lib/on_container/secrets/url_variable_processor.rb', line 31 def url_keys? url_keys.any? end |