summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/environment.rb7
-rw-r--r--lib/gitlab/git/storage/circuit_breaker.rb2
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/environment.rb b/lib/gitlab/environment.rb
new file mode 100644
index 00000000000..5e0dd6e7859
--- /dev/null
+++ b/lib/gitlab/environment.rb
@@ -0,0 +1,7 @@
+module Gitlab
+ module Environment
+ def self.hostname
+ @hostname ||= ENV['HOSTNAME'] || Socket.gethostname
+ end
+ end
+end
diff --git a/lib/gitlab/git/storage/circuit_breaker.rb b/lib/gitlab/git/storage/circuit_breaker.rb
index c722771e0d5..7b040a05c42 100644
--- a/lib/gitlab/git/storage/circuit_breaker.rb
+++ b/lib/gitlab/git/storage/circuit_breaker.rb
@@ -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