Class: OnContainer::Secrets::MountedFiles::EnvLoader

Inherits:
Object
  • Object
show all
Includes:
Common::SafePerformable
Defined in:
lib/on_container/secrets/mounted_files/env_loader.rb

Instance Method Summary collapse

Methods included from Common::SafePerformable

included, #perform

Instance Method Details

#perform!Object



13
14
15
16
17
# File 'lib/on_container/secrets/mounted_files/env_loader.rb', line 13

def perform!
  setup_secrets_path
  scan_secrets_path_for_files
  load_secret_files_to_env_vars
end

#secret_mounted_file_pathsObject Also known as: scan_secrets_path_for_files



23
24
25
26
27
# File 'lib/on_container/secrets/mounted_files/env_loader.rb', line 23

def secret_mounted_file_paths
  @secret_mounted_file_paths ||= Dir["#{secrets_path}/**/*"]
    .map { |path| Pathname.new(path) }
    .select(&:file?)
end

#secrets_pathObject Also known as: setup_secrets_path



19
20
21
# File 'lib/on_container/secrets/mounted_files/env_loader.rb', line 19

def secrets_path
  @secrets_path ||= ENV.fetch('SECRETS_PATH', '/run/secrets')
end