Module: Ironclad

Defined in:
lib/ironclad.rb,
lib/ironclad/cli.rb,
lib/ironclad/cache.rb,
lib/ironclad/config.rb,
lib/ironclad/source.rb,
lib/ironclad/railtie.rb,
lib/ironclad/version.rb,
lib/ironclad/key_store.rb,
lib/ironclad/cache/null.rb,
lib/ironclad/capistrano.rb,
lib/ironclad/cache/keyctl.rb,
lib/ironclad/cache/keychain.rb,
lib/ironclad/source/one_password.rb,
lib/generators/ironclad/install_generator.rb

Overview

Sources Rails credential keys from a secrets manager, cached in the local OS keystore.

Defined Under Namespace

Modules: Cache, Capistrano, Generators, Source Classes: CLI, Config, Error, KeyStore, Railtie

Constant Summary collapse

VERSION =
'0.2.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.config_pathObject



19
20
21
# File 'lib/ironclad.rb', line 19

def config_path
  @config_path ||= File.join(Dir.pwd, 'config', 'ironclad.yml')
end

Class Method Details

.configObject



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

def config
  @config ||= Config.load(config_path)
end

.configured?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ironclad.rb', line 23

def configured?
  File.exist?(config_path)
end

.key(environment = 'default', refresh: false) ⇒ Object

Return the credentials key for an environment, using the read-through cache. Pass refresh: true to bypass the cache after a key rotation.



37
38
39
# File 'lib/ironclad.rb', line 37

def key(environment = 'default', refresh: false)
  store.key(environment.to_s, refresh: refresh)
end

.reset!Object

Reset memoized state (mainly for tests).



42
43
44
45
# File 'lib/ironclad.rb', line 42

def reset!
  @config = nil
  @store = nil
end

.storeObject



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

def store
  @store ||= KeyStore.new(config)
end