Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-12 03:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-12 03:09:17 +0300
commitdf8c8224edcaa7458c1ac79444768dab71580783 (patch)
tree2b26b7b1e32b09aee4ca848c656536d0473748de /lib/gitlab/setup_helper.rb
parentfdc26e021b1e3eea4161bf6891f3a151fb7414b0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/setup_helper.rb')
-rw-r--r--lib/gitlab/setup_helper.rb35
1 files changed, 27 insertions, 8 deletions
diff --git a/lib/gitlab/setup_helper.rb b/lib/gitlab/setup_helper.rb
index a498e329c3f..1e42003b203 100644
--- a/lib/gitlab/setup_helper.rb
+++ b/lib/gitlab/setup_helper.rb
@@ -149,28 +149,47 @@ module Gitlab
module Praefect
extend Gitlab::SetupHelper
class << self
- def configuration_toml(gitaly_dir, _, _)
+ def configuration_toml(gitaly_dir, _storage_paths, options)
+ raise 'This configuration is only intended for test' unless Rails.env.test?
+
nodes = [{ storage: 'default', address: "unix:#{gitaly_dir}/gitaly.socket", primary: true, token: 'secret' }]
second_storage_nodes = [{ storage: 'test_second_storage', address: "unix:#{gitaly_dir}/gitaly2.socket", primary: true, token: 'secret' }]
storages = [{ name: 'default', node: nodes }, { name: 'test_second_storage', node: second_storage_nodes }]
- failover = { enabled: false, election_strategy: 'local' }
+
config = {
- i_understand_my_election_strategy_is_unsupported_and_will_be_removed_without_warning: true,
socket_path: "#{gitaly_dir}/praefect.socket",
- memory_queue_enabled: true,
virtual_storage: storages,
- failover: failover
+ token: 'secret'
}
- config[:token] = 'secret' if Rails.env.test?
+
+ if options[:per_repository]
+ failover = { enabled: true, election_strategy: 'per_repository' }
+ database = { host: options.fetch(:pghost),
+ port: options.fetch(:pgport).to_i,
+ user: options.fetch(:pguser),
+ dbname: options.fetch(:dbname, 'praefect_test') }
+
+ config.merge!(database: database,
+ failover: failover)
+ else
+ failover = { enabled: false, election_strategy: 'local' }
+
+ config.merge!(
+ i_understand_my_election_strategy_is_unsupported_and_will_be_removed_without_warning: true,
+ memory_queue_enabled: true,
+ failover: failover
+ )
+ end
TomlRB.dump(config)
end
private
- def get_config_path(dir, _)
- File.join(dir, 'praefect.config.toml')
+ def get_config_path(dir, options)
+ config_filename = options[:config_filename] || 'praefect.config.toml'
+ File.join(dir, config_filename)
end
end
end