Sha256: bd284bea36e6d3d371ae149b5d52a6bb5cf4ab42401daf8112737f1ce8224a5e
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module Orchestration module DockerCompose class Services def initialize(options = {}) @configurations = { 'database' => options.fetch(:database, nil), 'mongo' => options.fetch(:mongo, nil), 'rabbitmq' => options.fetch(:rabbitmq, nil) } end def structure { 'version' => '3.7', 'services' => services } end def services Hash[filtered_services] end private def filtered_services services_enabled.compact.reject { |_name, definition| definition.nil? } end def services_available [ { name: 'database', class: DatabaseService }, { name: 'mongo', class: MongoService }, { name: 'rabbitmq', class: RabbitMQService } ] end def services_enabled services_available.map do |service| config = @configurations[service[:name]] # REVIEW: This is mostly here for testing - we may not need it once # everything's implemented. next if config.nil? [service[:name], service[:class].new(config).definition] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
orchestration-0.2.1 | lib/orchestration/docker_compose/services.rb |
orchestration-0.2.0 | lib/orchestration/docker_compose/services.rb |