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

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

Constant Summary collapse

DB_CONFIGS =
{
  'sequel' => <<-SEQUEL.chomp,
  'dynamoid' => <<-DYNAMOID.chomp
    name: dynamoid
    dynamoid_config: true
    region:  'us-east-1'
    namespace: '${bot_name_snake_case}'
    read_capacity: 3
    write_capacity: 3
  DYNAMOID
}.freeze

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



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/kybus/cli/bot/file_providers/config_generator.rb', line 29

def make_contents
  <<~YAML + db_config.gsub('${bot_name_snake_case}', bot_name_snake_case)
    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
end

#saving_pathObject



25
26
27
# File 'lib/kybus/cli/bot/file_providers/config_generator.rb', line 25

def saving_path
  'config/config.yaml'
end