lib/faastruby/base.rb in faastruby-0.5.22 vs lib/faastruby/base.rb in faastruby-0.5.23
- old
+ new
@@ -1,12 +1,10 @@
module FaaStRuby
+ require "faastruby/regions"
ROOT_DOMAIN = ENV['FAASTRUBY_ROOT_DOMAIN'] || 'faastruby.io'
WORKSPACE_BASE_HOST = ENV['FAASTRUBY_WORKSPACE_BASE_HOST'] || 'faast.cloud'
- DEFAULT_REGION = 'tor1'
- REGIONS = [
- 'tor1'
- ]
+ URL_PROTOCOL = ENV['FAASTRUBY_URL_PROTOCOL'] || 'https'
class << self
attr_accessor :configuration
end
def self.api_key
@@ -24,21 +22,15 @@
def self.credentials
{api_key: api_key, api_secret: api_secret}
end
- def self.region
- ENV['FAASTRUBY_REGION'] ||= DEFAULT_REGION
- raise "No such region: #{ENV['FAASTRUBY_REGION']}" unless FaaStRuby::REGIONS.include?(ENV['FAASTRUBY_REGION'])
- ENV['FAASTRUBY_REGION']
- end
-
def self.api_host
- ENV['FAASTRUBY_HOST'] || "https://api.#{region}.#{ROOT_DOMAIN}"
+ ENV['FAASTRUBY_HOST'] || "#{URL_PROTOCOL}://api.#{region}.#{ROOT_DOMAIN}"
end
def self.workspace_host_for(workspace_name)
- "https://#{workspace_name}.#{region}.#{WORKSPACE_BASE_HOST}"
+ "#{URL_PROTOCOL}://#{workspace_name}.#{region}.#{WORKSPACE_BASE_HOST}"
end
class Configuration
attr_accessor :api_key, :api_secret
end