Sha256: 2c5b8d6246d9b832bd2976d0ba4713d0451074c958f62215de0fff3dc7bfca6f

Contents?: true

Size: 869 Bytes

Versions: 38

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

require 'hocon'
require 'bolt_server/base_config'
require 'bolt/error'

module PlanExecutor
  class Config < BoltServer::BaseConfig
    def config_keys
      super + %w[modulepath workers orchestrator-url]
    end

    def defaults
      super.merge(
        'port' => 62659,
        'workers' => 1
      )
    end

    def service_name
      'plan-executor'
    end

    def required_keys
      super + ['orchestrator-url']
    end

    def load_env_config
      env_keys.each do |key|
        transformed_key = "BOLT_#{key.tr('-', '_').upcase}"
        next unless ENV.key?(transformed_key)
        @data[key] = ENV[transformed_key]
      end
    end

    def validate
      super
      unless natural?(@data['workers'])
        raise Bolt::ValidationError, "Configured 'workers' must be a positive integer"
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
bolt-1.43.0 lib/plan_executor/config.rb
bolt-1.42.0 lib/plan_executor/config.rb
bolt-1.41.0 lib/plan_executor/config.rb
bolt-1.40.0 lib/plan_executor/config.rb
bolt-1.39.0 lib/plan_executor/config.rb
bolt-1.38.0 lib/plan_executor/config.rb
bolt-1.37.0 lib/plan_executor/config.rb
bolt-1.36.0 lib/plan_executor/config.rb
bolt-1.35.0 lib/plan_executor/config.rb
bolt-1.34.0 lib/plan_executor/config.rb
bolt-1.33.0 lib/plan_executor/config.rb
bolt-1.32.0 lib/plan_executor/config.rb
bolt-1.31.1 lib/plan_executor/config.rb
bolt-1.31.0 lib/plan_executor/config.rb
bolt-1.30.1 lib/plan_executor/config.rb
bolt-1.30.0 lib/plan_executor/config.rb
bolt-1.29.1 lib/plan_executor/config.rb
bolt-1.29.0 lib/plan_executor/config.rb
bolt-1.28.0 lib/plan_executor/config.rb
bolt-1.27.1 lib/plan_executor/config.rb