class Sekreto::Config

Config class for setting up Sekreto for usage

Constants

DEFAULT_PREFIX

Attributes

fallback_lookup[RW]
is_allowed_env[RW]
logger[RW]
prefix[RW]
secrets_manager[RW]

Public Class Methods

new() click to toggle source

Initialize a new Config

@return [Sekreto::Config]

# File lib/sekreto/config.rb, line 22
def initialize
  @prefix = DEFAULT_PREFIX
  @is_allowed_env = -> { true }
  @fallback_lookup = ->(secret_id) { ENV[secret_id] }
  @secrets_manager = nil
  @logger = Logger.new(STDOUT)
end

Public Instance Methods

prefix_name(prefix_path = nil) click to toggle source

Get the prefix name to use when looking up secrets

@param prefix_path [String,NilClass,FalseClass] - The path to use for the prefix

@return [String] prefix path

@example If a nil is passed it defaults to the config.prefix.

When a false is passed then no prefix is used. (Not recommended)
# File lib/sekreto/config.rb, line 40
def prefix_name(prefix_path = nil)
  return nil if prefix_path == false

  prefix_path || prefix
end