Sha256: 0d8ac90bf2e4f80c9507ee930a4112d1e03552092bd2a5b1b82725e3c72f3a04

Contents?: true

Size: 966 Bytes

Versions: 1

Compression:

Stored size: 966 Bytes

Contents

require 'hashr'

module Vx
  module Worker
    class Configuration < ::Hashr

      extend Hashr::EnvDefaults

      self.env_namespace = 'vx'
      self.raise_missing_keys = true

      define amqp_url:     nil,
             run:          "docker",
             timeout:      30 * 60,

             workers:          1,
             path_prefix:      nil,

             docker: {
               user:       nil,
               password:   nil,
               init:       nil,
               image:      nil,
               remote_dir: nil
             },

             local: {
               remote_dir: nil
             }

      def timeout
        self[:timeout].to_i
      end

      def run
        self[:run].to_sym
      end

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

      def connector_options
        self[self.run]
      end

      def connector_remote_dir
        connector_options[:remote_dir]
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vx-worker-0.3.0.pre1 lib/vx/worker/configuration.rb