Skip to content
Snippets Groups Projects

Add rake task for copying 'main' database to 'ci' database

2 files
+ 45
12
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -16,7 +16,7 @@ class DatabaseModel
sslcompression: 'PGSSLCOMPRESSION'
}.freeze
OVERRIDE_PREFIX = "GITLAB_BACKUP_"
OVERRIDE_PREFIXES = %w[GITLAB_BACKUP_ GITLAB_OVERRIDE_].freeze
attr_reader :config
@@ -68,14 +68,16 @@ def config_for_backup(name, config)
# This enables the use of different PostgreSQL settings in
# case PgBouncer is used. PgBouncer clears the search path,
# which wreaks havoc on Rails if connections are reused.
override_all = "#{OVERRIDE_PREFIX}#{arg}"
override_db = "#{OVERRIDE_PREFIX}#{name.upcase}_#{arg}"
val = ENV[override_db].presence || ENV[override_all].presence || config[opt].to_s.presence
OVERRIDE_PREFIXES.each do |override_prefix|
override_all = "#{override_prefix}#{arg}"
override_db = "#{override_prefix}#{name.upcase}_#{arg}"
val = ENV[override_db].presence || ENV[override_all].presence || config[opt].to_s.presence
next unless val
next unless val
db_config[:pg_env][arg] = val
db_config[:activerecord][opt] = val
db_config[:pg_env][arg] = val
db_config[:activerecord][opt] = val
end
end
db_config
Loading