Class: Cosmos::CosmosAuthentication
- Defined in:
- lib/cosmos/utilities/authentication.rb
Overview
Cosmos base / open source authentication code
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize ⇒ CosmosAuthentication
constructor
A new instance of CosmosAuthentication.
-
#token ⇒ Object
Load the token from the environment.
Constructor Details
#initialize ⇒ CosmosAuthentication
Returns a new instance of CosmosAuthentication.
31 32 33 34 35 36 |
# File 'lib/cosmos/utilities/authentication.rb', line 31 def initialize() @token = ENV['COSMOS_API_PASSWORD'] || ENV['COSMOS_SERVICE_PASSWORD'] if @token.nil? raise CosmosAuthenticationError, "Authentication requires environment variables COSMOS_API_PASSWORD or COSMOS_SERVICE_PASSWORD" end end |
Instance Method Details
#token ⇒ Object
Load the token from the environment
39 40 41 |
# File 'lib/cosmos/utilities/authentication.rb', line 39 def token() @token end |