Sha256: e47b2eca7030ec9e992a197ae67c28bd47e116cca5d61477ec52a354efe96023
Contents?: true
Size: 1.44 KB
Versions: 5
Compression:
Stored size: 1.44 KB
Contents
# typed: ignore require 'logger' require 'rails/railtie' require 'rails/command' require 'rails/commands/dbconsole/dbconsole_command' module Kuby module CockroachConsoleMonkeypatch def start config_hash = if respond_to?(:config) config_hash = config else config_hash = db_config.configuration_hash.stringify_keys end return super unless config_hash['adapter'] == 'cockroachdb' ENV['PGUSER'] = config_hash['username'] if config_hash['username'] ENV['PGHOST'] = config_hash['host'] if config_hash['host'] ENV['PGPORT'] = config_hash['port'].to_s if config_hash['port'] ENV['PGPASSWORD'] = config_hash['password'].to_s if config_hash['password'] && @options['include_password'] ENV['PGSSLMODE'] = config_hash['sslmode'].to_s if config_hash['sslmode'] ENV['PGSSLCERT'] = config_hash['sslcert'].to_s if config_hash['sslcert'] ENV['PGSSLKEY'] = config_hash['sslkey'].to_s if config_hash['sslkey'] ENV['PGSSLROOTCERT'] = config_hash['sslrootcert'].to_s if config_hash['sslrootcert'] find_cmd_and_exec('psql', config_hash['database']) end end class Railtie < ::Rails::Railtie initializer 'kuby.health_check_middleware' do |app| app.middleware.use Kuby::Middleware::HealthCheck end initializer 'kuby.cockroachdb_console_support' do Rails::DBConsole.prepend(CockroachConsoleMonkeypatch) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
kuby-core-0.20.2 | lib/kuby/railtie.rb |
kuby-core-0.20.1 | lib/kuby/railtie.rb |
kuby-core-0.20.0 | lib/kuby/railtie.rb |
kuby-core-0.19.0 | lib/kuby/railtie.rb |
kuby-core-0.18.0 | lib/kuby/railtie.rb |