Sha256: 23016f4baccd41ca66f2f0e9de89b863d3c1a9bcbfec1ebaf66b4c710a1080a1

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

require 'dry/system/container'
require 'pg_export/lib/pg_export/types'

class PgExport
  class Container < Dry::System::Container
    configure do
      config.root = Pathname(__FILE__).realpath.dirname
      config.name = :pg_export
      config.default_namespace = 'pg_export'
      config.auto_register = %w[lib]
    end

    load_paths!('lib')

    boot(:ftp) do
      init do
        require 'pg_export/lib/pg_export/factories/ftp_gateway_factory'
      end

      start do
        use :config
        register('factories.gateway_factory') { ::PgExport::Factories::FtpGatewayFactory.new }
      end
    end

    boot(:ssh) do
      init do
        require 'pg_export/lib/pg_export/factories/ssh_gateway_factory'
      end

      start do
        use :config
        register('factories.gateway_factory') { ::PgExport::Factories::SshGatewayFactory.new }
      end
    end

    boot(:main) do |system|
      init do
        require 'pg_export/lib/pg_export/operations/encrypt_dump'
        require 'pg_export/lib/pg_export/operations/decrypt_dump'
        require 'pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp'
        require 'pg_export/lib/pg_export/operations/open_connection'
      end

      start do
        use(system[:config].gateway)

        register('operations.encrypt_dump') { ::PgExport::Operations::EncryptDump.new }
        register('operations.decrypt_dump') { ::PgExport::Operations::DecryptDump.new }
        register('operations.remove_old_dumps_from_ftp') { ::PgExport::Operations::RemoveOldDumpsFromFtp.new }
        register('operations.open_connection') { ::PgExport::Operations::OpenConnection.new }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pg_export-1.0.0.rc3 lib/pg_export/container.rb
pg_export-1.0.0.rc2 lib/pg_export/container.rb
pg_export-1.0.0.rc1 lib/pg_export/container.rb