Skip to content

Instantly share code, notes, and snippets.

@ksob
Created March 25, 2015 09:50
Show Gist options
  • Save ksob/a810005158db5872a14b to your computer and use it in GitHub Desktop.
Save ksob/a810005158db5872a14b to your computer and use it in GitHub Desktop.
/Users/developer/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/proxy_authentication-0.1.0/lib/proxy_authentication/configuration.rb
module ProxyAuthentication
class Configuration
DEFAULT_SECRET = "api_proxy_auth_secret_key".freeze
DEFAULT_URL = "http://localhost:8080/".freeze # "https://api.sageone.com/v2/".freeze
attr_reader :secure_store
def initialize(secure_store, env)
@secure_store = secure_store.load[env, :api_proxy]
rescue Exception
message = "No configuration for api proxy found. Falling back to defaults."
puts message
end
def secret
DEFAULT_SECRET # secure_secret || DEFAULT_SECRET
end
def url
DEFAULT_URL #secure_url || DEFAULT_URL
end
private
def secure_secret
secure_store['secret'] if secure_store
end
def secure_url
secure_store['url'] if secure_store
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment