Module: SecretConfig

Extended by:
Forwardable
Defined in:
lib/secret_config.rb,
lib/secret_config/errors.rb,
lib/secret_config/version.rb,
lib/secret_config/registry.rb,
lib/secret_config/providers/ssm.rb,
lib/secret_config/providers/file.rb

Overview

Centralized Configuration and Secrets Management for Ruby and Rails applications.

Defined Under Namespace

Modules: Providers Classes: ConfigurationError, Error, MissingMandatoryKey, Registry, UndefinedRootError

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.provider(provider = nil, **args) ⇒ Object

When provider is not supplied, returns the current provider instance When provider is supplied, sets the new provider and stores any arguments



38
39
40
41
42
43
44
45
# File 'lib/secret_config.rb', line 38

def self.provider(provider = nil, **args)
  if provider.nil?
    return @provider ||= create_provider((ENV["SECRET_CONFIG_PROVIDER"] || :file).to_sym)
  end

  @provider      = create_provider(provider, args)
  @registry      = nil if @registry
end

.provider=(provider) ⇒ Object



47
48
49
50
# File 'lib/secret_config.rb', line 47

def self.provider=(provider)
  @provider = provider
  @registry = nil if @registry
end

.registryObject



52
53
54
# File 'lib/secret_config.rb', line 52

def self.registry
  @registry ||= SecretConfig::Registry.new(root: root, provider: provider)
end

.rootObject



26
27
28
29
# File 'lib/secret_config.rb', line 26

def self.root
  @root ||= ENV["SECRET_CONFIG_ROOT"] ||
    raise(UndefinedRootError, "Either set env var 'SECRET_CONFIG_ROOT' or call SecretConfig.root=")
end

.root=(root) ⇒ Object



31
32
33
34
# File 'lib/secret_config.rb', line 31

def self.root=(root)
  @root     = root
  @registry = nil if @registry
end