lib/faastruby-rpc/function.rb in faastruby-rpc-0.2.6 vs lib/faastruby-rpc/function.rb in faastruby-rpc-0.2.7

- old
+ new

@@ -13,12 +13,13 @@ def body=(value) @body = value end end class Function - @@region = ENV['REGION'] - @@endpoint_base_host = ENV['ENDPOINT_BASE_HOST'] + @@region = ENV['FAASTRUBY_REGION'] + @@endpoint_base_host = ENV['FAASTRUBY_WORKSPACE_BASE_HOST'] + @@endpoint_base_protocol = ENV['FAASTRUBY_URL_PROTOCOL'] || 'https' def self.workspace=(workspace) @@workspace = workspace end def initialize(path, raise_errors: true) @response = nil @@ -40,10 +41,10 @@ end self end def get_endpoint(query_params) - return "https://#{@@workspace}.#{@@region}.#{@@endpoint_base_host}/#{@path}#{query_params}" if @@endpoint_base_host && @@region && @@workspace + return "#{@@endpoint_base_protocol}://#{@@workspace}.#{@@region}.#{@@endpoint_base_host}/#{@path}#{query_params}" if @@endpoint_base_host && @@region && @@workspace return "http://localhost:3000/#{@path}#{query_params}" end def execute(req_body: nil, query_params: {}, headers: {}, method: 'post') url = get_endpoint(convert_query_params(query_params))