Module: Ec::Pg::SchemaRegistry::Mixin
- Extended by:
- ActiveSupport::Concern
- Included in:
- Cloner, Ec::Pg::SchemaRegistryMixin
- Defined in:
- lib/ec/pg/schema_registry/mixin.rb
Instance Method Summary collapse
Instance Method Details
#configurations ⇒ Object
33 34 35 |
# File 'lib/ec/pg/schema_registry/mixin.rb', line 33 def configurations @configurations ||= connection.pool.db_config.configuration_hash end |
#shell_command(command) ⇒ Object
28 29 30 31 |
# File 'lib/ec/pg/schema_registry/mixin.rb', line 28 def shell_command(command) puts command %x(#{command}) end |
#with_pg_env(&block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ec/pg/schema_registry/mixin.rb', line 9 def with_pg_env(&block) pghost = ENV['PGHOST'] pgport = ENV['PGPORT'] pguser = ENV['PGUSER'] pgpassword = ENV['PGPASSWORD'] ENV['PGUSER'] = configurations[:superusername] if configurations[:superusername] ENV['PGHOST'] = configurations[:host] if configurations[:host] ENV['PGPORT'] = configurations[:port].to_s if configurations[:port] ENV['PGPASSWORD'] = configurations[:password].to_s if configurations[:password] block.call ensure ENV['PGHOST'] = pghost ENV['PGPORT'] = pgport ENV['PGUSER'] = pguser ENV['PGPASSWORD'] = pgpassword end |