Sha256: 6db2a8ead6e7c70492ac75b5c93c50147eed93cbe74936c26ff69c846689bb26

Contents?: true

Size: 743 Bytes

Versions: 6

Compression:

Stored size: 743 Bytes

Contents

module Microstatic
  class Config
    class MissingEnvVar < RuntimeError
    end

    def self.automagic
      #in the future this'll try to create a config based on 
      #various diff. files, in priority order?
      self.new 
    end

    def site_name
      env_var('MICROSTATIC_SITE_NAME')
    end

    def aws_creds
      {
        :access_key_id => aws_access_key_id,
        :secret_access_key => aws_secret_access_key
      }
    end

    def aws_access_key_id
      env_var('AWS_ACCESS_KEY_ID')
    end

    def aws_secret_access_key
      env_var('AWS_SECRET_ACCESS_KEY')
    end

    private 

    def env_var(key)
      ENV.fetch(key) { raise MissingEnvVar.new("you must set the #{key} environment variable") }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
microstatic-0.6.0 lib/microstatic/config.rb
microstatic-0.5.2 lib/microstatic/config.rb
microstatic-0.5.1 lib/microstatic/config.rb
microstatic-0.5.0 lib/microstatic/config.rb
microstatic-0.4.2 lib/microstatic/config.rb
microstatic-0.4.1 lib/microstatic/config.rb