Class: SecretsManager::Config::SecretConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/secrets_manager/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, id, input, type, path) ⇒ SecretConfig

Returns a new instance of SecretConfig.



31
32
33
34
35
36
37
# File 'lib/secrets_manager/config.rb', line 31

def initialize(name, id, input, type, path)
  @name = name
  @id = id
  @input = input || 'json'
  @type = type || 'env'
  @path = path || 'config/application.yml'
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



29
30
31
# File 'lib/secrets_manager/config.rb', line 29

def id
  @id
end

#inputObject (readonly)

Returns the value of attribute input.



29
30
31
# File 'lib/secrets_manager/config.rb', line 29

def input
  @input
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/secrets_manager/config.rb', line 29

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



29
30
31
# File 'lib/secrets_manager/config.rb', line 29

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.



29
30
31
# File 'lib/secrets_manager/config.rb', line 29

def type
  @type
end

Instance Method Details

#json?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/secrets_manager/config.rb', line 43

def json?
  input == 'json'
end

#json_output?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/secrets_manager/config.rb', line 59

def json_output?
  path.strip.end_with? '.json'
end

#plaintext?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/secrets_manager/config.rb', line 39

def plaintext?
  input == 'plaintext'
end

#to_env?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/secrets_manager/config.rb', line 47

def to_env?
  type == 'env'
end

#to_file?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/secrets_manager/config.rb', line 51

def to_file?
  type == 'file'
end

#yaml_output?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/secrets_manager/config.rb', line 55

def yaml_output?
  path.strip.end_with? '.yml'
end