Sha256: 60f7cdd304523e4f5aa2ce5ba1e062fa925eb34f6d85ad8ca389dd27705ad0b8
Contents?: true
Size: 1.43 KB
Versions: 6
Compression:
Stored size: 1.43 KB
Contents
# frozen_string_literal: true module Orchestration module DockerCompose class Services def initialize(options = {}) @configurations = { 'application' => options.fetch(:application, nil), 'database' => options.fetch(:database, nil), 'mongo' => options.fetch(:mongo, nil), 'rabbitmq' => options.fetch(:rabbitmq, nil), 'nginx-proxy' => options.fetch(:nginx_proxy, 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: 'application', class: ApplicationService }, { name: 'database', class: DatabaseService }, { name: 'mongo', class: MongoService }, { name: 'rabbitmq', class: RabbitMQService }, { name: 'nginx-proxy', class: NginxProxyService } ] 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
6 entries across 6 versions & 1 rubygems