Class: Gleis::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/gleis/config.rb

Overview

Global parameters of gleis gem and app config env variables

Constant Summary collapse

API_URL =

Override default API URL if GLEIS_API_URL env variable is set

ENV['GLEIS_API_URL'].nil? ? 'https://api.basel.gleis.app/' : ENV['GLEIS_API_URL']
API_VERSION =
'v0'.freeze
SSH_KEY_FILE_BASE =
File.join(Dir.home, '.ssh', 'gleis')
TOKEN_FILE =
File.join(Dir.home, '.gleis-token')

Class Method Summary collapse

Class Method Details

.get_env_var(app_name, token, var_name) ⇒ Object



16
17
18
19
# File 'lib/gleis/config.rb', line 16

def self.get_env_var(app_name, token, var_name)
  body = API.request('get', "config/#{app_name}/#{var_name}", token)
  return body['data'] if body['success'] == 1
end

.get_env_vars(app_name, token) ⇒ Object



10
11
12
13
14
# File 'lib/gleis/config.rb', line 10

def self.get_env_vars(app_name, token)
  body = API.request('get', "config/#{app_name}", token)
  abort("Failed to get app environment variables: #{body['message']}") if body['success'] != 1
  body
end