Sha256: 340cbdc55b0f5e2843447369d7e629a816bfec7bebfb805c0619fe5eaf22bef3

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

require 'hashr'
require 'logger'
require 'evrone/ci/common/tagged_logging'

module Evrone
  module CI
    module Worker
      class Configuration < ::Hashr

        extend Hashr::EnvDefaults

        @@null_logger = Logger.new("/dev/null")

        self.env_namespace = 'ci_worker'
        self.raise_missing_keys = true

        define amqp_url:     nil,
               run:          "docker",
               timeout:      30 * 60,
               logger:       Common::TaggedLogging.new(Logger.new STDOUT),

               work_dir_name:   "work",
               repo_dir_name:   "repo",
               tmp_dir_name:    "tmp",

               sleep_after_job: 5,

               workers:         1,
               path_prefix:     nil,
               webdav_cache_url:nil,

               docker: {
                 remote_dir: "/home/ci",
                 init:       %w{ /usr/local/bin/runsvdir -P /etc/service },
                 image:      "ci",

                 ssh: {
                   host:     nil, # used in tests
                   port:     nil, # used in tests
                   user:     "ci",
                   password: "ci"
                 },

                 create_options: nil # used in tests
               }

        def timeout
          self[:timeout].to_i
        end

        def run
          self[:run].to_sym
        end

        def path_prefix
          self[:path_prefix] || Dir.pwd
        end

        def null_logger
          @@null_logger
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
evrone-ci-worker-0.2.0.pre4 lib/evrone/ci/worker/configuration.rb
evrone-ci-worker-0.2.0.pre3 lib/evrone/ci/worker/configuration.rb