Class: K8sflow::Utils::Varager

Inherits:
Object
  • Object
show all
Defined in:
lib/k8sflow/utils/varager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, endpoint) ⇒ Varager

Returns a new instance of Varager.



10
11
12
13
14
15
16
17
18
# File 'lib/k8sflow/utils/varager.rb', line 10

def initialize(token, endpoint)
  ::Varager.logger.level = 1
  @client = ::Varager::Client.new
  puts "TOKEN"
  puts token
  @client.auth_token.update(:token => token)
  puts @client.auth_token.options
  @client.site = endpoint
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/k8sflow/utils/varager.rb', line 8

def client
  @client
end

Instance Method Details

#envs(app, db_only = true) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/k8sflow/utils/varager.rb', line 20

def envs(app, db_only=true)
  envs = @client.get_env(params: {id: app}).vars
  #pp "overrided vars: #{@options.envvars}"
  db_vars = ["DATABASE_URL",
             "MEMCACHIER_PASSWORD",
             "MEMCACHIER_SERVERS",
             "MEMCACHIER_USERNAME",
             "REDISTOGO_URL",
             "REDIS_PROVIDER"]
  if db_only == true
    envs.select!{|k,v| db_vars.index(k) != nil}
  end
  pp envs
  return envs
end