Class: Luciq::Config

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

Constant Summary collapse

CONFIG_FILE =
File.expand_path('~/.luciqrc')
DEFAULT_BASE_URL =
'https://api.luciq.ai'

Class Method Summary collapse

Class Method Details

.clear_tokenObject



22
23
24
# File 'lib/luciq/config.rb', line 22

def clear_token
  delete_value('token')
end

.load_base_urlObject



9
10
11
# File 'lib/luciq/config.rb', line 9

def load_base_url
  ENV['LUCIQ_URL'] || load_value('url') || DEFAULT_BASE_URL
end

.load_tokenObject



13
14
15
16
# File 'lib/luciq/config.rb', line 13

def load_token
  token = ENV['LUCIQ_AUTH_TOKEN'] || load_value('token')
  token unless token.to_s.strip.empty?
end

.save_token(token) ⇒ Object



18
19
20
# File 'lib/luciq/config.rb', line 18

def save_token(token)
  add_value('token', token)
end