Class: Kybus::CLI::Bot::Config::ConfigGenerator

Inherits:
FileProvider
  • Object
show all
Defined in:
lib/kybus/cli/bot/file_providers/config_generator.rb

Instance Method Summary collapse

Methods inherited from FileProvider

autoregister!, #bot_name, #bot_name_class, #bot_name_constantize, #bot_name_snake_case, #generate, #initialize, #keep_files, #skip_file?

Constructor Details

This class inherits a constructor from Kybus::CLI::Bot::FileProvider

Instance Method Details

#make_contentsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/kybus/cli/bot/file_providers/config_generator.rb', line 13

def make_contents
  content = <<~YAML
    bots:
      main:
        provider:
          name: #{@config[:bot_provider]}
          token: #{@config[:bot_token]}
          mode: #{@config[:with_deployment_file] && @config[:cloud_provider] == 'aws' ? 'webhook_lambda' : 'polling'}
          debug: true
        state_repository:
  YAML

  if @config[:db_adapter] == 'sequel'
    content << <<-SEQUEL
        name: sequel
        endpoint: 'sqlite://#{bot_name_snake_case}_botmeta.db'
    SEQUEL
  elsif @config[:db_adapter] == 'dynamoid'
    content << <<-DYNAMOID
        name: dynamoid
        dynamoid_config: true
        region:  'us-east-1'
        namespace: '#{bot_name_snake_case}'
        read_capacity: 3
        write_capacity: 3
    DYNAMOID
  end
end

#saving_pathObject



9
10
11
# File 'lib/kybus/cli/bot/file_providers/config_generator.rb', line 9

def saving_path
  'config/config.yaml'
end