Sha256: 09e4f5b52c50278c1f33e2a22bb09464de3e29d4023d46caaed1a92eeaf39590

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

require 'json'
require 'secrets_loader/config'
require 'secrets_loader/version'

module SecretsLoader
  class << self
    attr_accessor :config

    def load
      return unless enable?

      secret_values.each do |key, value|
        if ENV.has_key?(key.to_s)
          warn "WARNING: Skipping key #{key.inspect}. Already set in ENV."
        else
          ENV[key.to_s] = value.to_s
        end
      end
    end

    private

    def secret_values
      config.loader.load
    end

    def enable?
      config.loader.enable?
    end
  end

  self.config = SecretsLoader::Config.new
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
secrets_loader-0.1.1 lib/secrets_loader.rb