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), tmp_dir_name: "tmp", workers: 1, path_prefix: 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