Sha256: e093d0911bf5c4e5c7252f8c624c7db8e1b760524bcc50c46e7f256983a7230c
Contents?: true
Size: 1.11 KB
Versions: 17
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module Orchestration module DockerCompose class DatabaseService include ComposeHelpers def initialize(config, environment) @environment = environment @config = config end def definition return nil unless @config.enabled? return nil if adapter.name == 'sqlite3' { 'image' => adapter.image, 'environment' => adapter.environment }.merge(ports).merge(volumes) end private def adapter name = ComposeConfiguration.new(@environment).database_adapter_name base = 'Orchestration::Services::Database::Adapters' Object.const_get("#{base}::#{name.capitalize}").new end def remote_port adapter.default_port end def ports return {} unless %i[development test].include?(@environment) { 'ports' => ["#{sidecar_port(@environment)}#{remote_port}"] } end def volumes return {} if @environment == :test { 'volumes' => ["#{@config.env.database_volume}:#{adapter.data_dir}"] } end end end end
Version data entries
17 entries across 17 versions & 1 rubygems