Class: TelegramMeetupBot::Initializers::ConfigLoader

Inherits:
Base
  • Object
show all
Defined in:
lib/telegram_meetup_bot/initializers/config_loader.rb

Constant Summary collapse

EMPTY =
''
FILE_NAME =
'config.yml'
AVAILABLE_KEYS =
%w(bot_token bot_name redis_key
redis_port redis_host botan_key)

Class Method Summary collapse

Methods inherited from Base

exit_if_file_not_exist, preload, validate

Class Method Details

.bot_nameObject



18
19
20
# File 'lib/telegram_meetup_bot/initializers/config_loader.rb', line 18

def bot_name
  @configurations['bot_name']
end

.botan_keyObject



22
23
24
25
26
27
28
# File 'lib/telegram_meetup_bot/initializers/config_loader.rb', line 22

def botan_key
  @key ||= if @configurations['botan_key'] == EMPTY
    nil
  else
    @configurations['botan_key']
  end
end

.storageObject



10
11
12
# File 'lib/telegram_meetup_bot/initializers/config_loader.rb', line 10

def storage
  @storage ||= Storage.new(redis: redis, redis_key: redis_key)
end

.tokenObject



14
15
16
# File 'lib/telegram_meetup_bot/initializers/config_loader.rb', line 14

def token
  @configurations['bot_token']
end