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
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'] || 'development' @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
22 23 24 |
# File 'lib/secrets_cli/configuration.rb', line 22 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 |
# File 'lib/secrets_cli/configuration.rb', line 10 def config @config ||= YAML.load_file(SECRETS_CONFIG_FILE) end |
#secrets_file ⇒ Object
14 15 16 |
# File 'lib/secrets_cli/configuration.rb', line 14 def secrets_file config[:secrets_file] end |
#secrets_storage_key ⇒ Object
18 19 20 |
# File 'lib/secrets_cli/configuration.rb', line 18 def secrets_storage_key config[:secrets_storage_key] end |