Sha256: 4a93dcfde691924f5d37fc6c0babc425a9d8c859c7717c66b1f501d54657f4f3
Contents?: true
Size: 1.5 KB
Versions: 80
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true require 'avm/stereotypes/postgresql/instance/data_unit' module Avm module Stereotypes module Postgresql class Instance def initialize(env, connection_params) @env = env @connection_params = connection_params.with_indifferent_access end def data_unit ::Avm::Stereotypes::Postgresql::Instance::DataUnit.new(self) end def dump_command env.command('pg_dump', '--no-privileges', '--clean', '--no-owner', *common_command_args) .envvar('PGPASSWORD', password) end def dump_gzip_command dump_command.append(['@ESC_|', 'gzip', '-9', '-c']) end def psql_command env.command("@ESC_PGPASSWORD=#{password}", 'psql', *common_command_args) end def psql_command_command(sql) psql_command.append(['--quiet', '--tuples-only', '--command', sql]) end private attr_reader :env, :connection_params def common_command_args ['--host', host, '--username', user, '--port', port, name] end def host connection_params[:host] || '127.0.0.1' end def port connection_params[:port] || '5432' end def user connection_params.fetch(:user) end def password connection_params.fetch(:password) end def name connection_params.fetch(:name) end end end end end
Version data entries
80 entries across 80 versions & 1 rubygems