Sha256: 352d33eab431a710233639baf8611dd4ae5bb0bea9b784d67651fc268cc57a2f

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

module PansophyAuthenticator
  module Configuration
    class FromEnv
      def initialize(base_configuration)
        @base_configuration = base_configuration
      end

      def configuration
        Instance.new(
          local:       local,
          bucket_name: bucket_name,
          file_path:   file_path,
          application: application
        )
      end

      private

      def local
        local = ENV.fetch('PANSOPHY_AUTHENTICATOR_LOCAL') { @base_configuration.local }
        local.to_s == 'true'
      end

      def bucket_name
        ENV.fetch('PANSOPHY_AUTHENTICATOR_BUCKET_NAME') { @base_configuration.bucket_name }
      end

      def file_path
        ENV.fetch('PANSOPHY_AUTHENTICATOR_FILE_PATH') { @base_configuration.file_path }
      end

      def application
        ENV.fetch('PANSOPHY_AUTHENTICATOR_APPLICATION') { @base_configuration.application }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pansophy_authenticator-0.1.0 lib/pansophy_authenticator/configuration/from_env.rb