Geo: use GeoNode#clone_url_prefix for the Geo::RepositorySyncService

parent 7a048641
......@@ -93,7 +93,7 @@ module Geo
end
def primary_ssh_path_prefix
Gitlab::Geo.primary_ssh_path_prefix
Gitlab::Geo.primary_node.clone_url_prefix
end
def ssh_url_to_repo
......
......@@ -58,10 +58,6 @@ module Gitlab
self.cache_value(:geo_node_secondary) { self.enabled? && self.current_node && self.current_node.secondary? }
end
def self.primary_ssh_path_prefix
self.cache_value(:geo_primary_ssh_path_prefix) { self.enabled? && self.primary_node && build_primary_ssh_path_prefix }
end
def self.geo_node?(host:, port:)
GeoNode.where(host: host, port: port).exists?
end
......@@ -145,19 +141,5 @@ module Gitlab
# urlsafe_base64 may return a string of size * 4/3
SecureRandom.urlsafe_base64(size)[0, size]
end
def self.build_primary_ssh_path_prefix
primary_host = "#{Gitlab.config.gitlab_shell.ssh_user}@#{self.primary_node.host}"
if Gitlab.config.gitlab_shell.ssh_port != 22
"ssh://#{primary_host}:#{Gitlab.config.gitlab_shell.ssh_port}/"
else
if self.primary_node.host.include? ':'
"[#{primary_host}]:"
else
"#{primary_host}:"
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment