提交 3899d07f 编写于 作者: B Bob Van Landuyt

Move hostname to Gitlab::Environment

上级 0fa94a0d
......@@ -222,7 +222,6 @@ Settings.gitlab['default_branch_protection'] ||= 2
Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
Settings.gitlab['host'] ||= ENV['GITLAB_HOST'] || 'localhost'
Settings.gitlab['ssh_host'] ||= Settings.gitlab.host
Settings.gitlab['hostname'] ||= ENV['HOSTNAME'] || Socket.gethostname
Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
Settings.gitlab['port'] ||= ENV['GITLAB_PORT'] || (Settings.gitlab.https ? 443 : 80)
Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || ''
......
module Gitlab
module Environment
def self.hostname
@hostname ||= ENV['HOSTNAME'] || Socket.gethostname
end
end
end
......@@ -31,7 +31,7 @@ module Gitlab
cached_circuitbreakers[storage]
end
def initialize(storage, hostname = Gitlab.config.gitlab.hostname)
def initialize(storage, hostname = Gitlab::Environment.hostname)
@storage = storage
@hostname = hostname
......
......@@ -64,7 +64,7 @@ feature "Admin Health Check", feature: true, broken_storage: true do
end
it 'shows storage failure information' do
hostname = Gitlab.config.gitlab.hostname
hostname = Gitlab::Environment.hostname
expect(page).to have_content('broken: failed storage access attempt on host:')
expect(page).to have_content("#{hostname}: 1 of 10 failures.")
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state: true, broken_storage: true do
let(:circuit_breaker) { described_class.new('default') }
let(:hostname) { Gitlab.config.gitlab.hostname }
let(:hostname) { Gitlab::Environment.hostname }
let(:cache_key) { "storage_accessible:default:#{hostname}" }
def value_from_redis(name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册