Class: SecretsCli::Configuration
- Inherits:
-
Object
- Object
- SecretsCli::Configuration
- Defined in:
- lib/secrets_cli/configuration.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(options) ⇒ Configuration
constructor
A new instance of Configuration.
- #secrets_file ⇒ Object
- #secrets_storage_key ⇒ Object
- #vault_addr ⇒ Object
Constructor Details
#initialize(options) ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 |
# File 'lib/secrets_cli/configuration.rb', line 5 def initialize() @environment = (.environment || ENV['RAILS_ENV'] || ENV['NODE_ENV'] || 'development').to_sym @verbose = .verbose end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
3 4 5 |
# File 'lib/secrets_cli/configuration.rb', line 3 def environment @environment end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
3 4 5 |
# File 'lib/secrets_cli/configuration.rb', line 3 def verbose @verbose end |
Class Method Details
.write(config) ⇒ Object
27 28 29 |
# File 'lib/secrets_cli/configuration.rb', line 27 def self.write(config) File.open(SECRETS_CONFIG_FILE, 'w') { |file| file.write(config.to_yaml) } end |
Instance Method Details
#config ⇒ Object
10 11 12 13 |
# File 'lib/secrets_cli/configuration.rb', line 10 def config @config ||= Psych.load(File.read(SECRETS_CONFIG_FILE), symbolize_names: true) end |
#secrets_file ⇒ Object
15 16 17 |
# File 'lib/secrets_cli/configuration.rb', line 15 def secrets_file fetch(:secrets_file) end |
#secrets_storage_key ⇒ Object
19 20 21 |
# File 'lib/secrets_cli/configuration.rb', line 19 def secrets_storage_key fetch(:secrets_storage_key) end |
#vault_addr ⇒ Object
23 24 25 |
# File 'lib/secrets_cli/configuration.rb', line 23 def vault_addr fetch(:vault_addr) || ENV['VAULT_ADDR'] end |