Sha256: aa95c8cbff231803db013b5080f1454cce45fdbdd2e59f7a1c53550d59b6910f
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true require 'memoizable' require 'yamload' module PansophyAuthenticator module Configuration class FromFile include Memoizable DEFAULT_FILENAME = 'pansophy_authenticator'.freeze 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 content.fetch('local') { @base_configuration.local } end def bucket_name content.fetch('bucket_name') { @base_configuration.bucket_name } end def file_path content.fetch('file_path') { @base_configuration.file_path } end def application content.fetch('application') { @base_configuration.application } end def pathname Pathname.new(@base_configuration.configuration_path) end memoize :pathname def dirname return pathname if pathname.directory? pathname.dirname end memoize :dirname def filename return Pathname.new(DEFAULT_FILENAME) if pathname.directory? pathname.basename('.yml') end memoize :filename def content loader.content end memoize :content def loader Yamload::Loader.new(filename, dirname) 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_file.rb |