summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-08-03 12:16:45 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-08-04 15:38:49 +0200
commit3899d07f9eb5ffa2369195c800be18e297f67613 (patch)
tree5a8e252d127878f4057ec884f3407874b86645d4 /lib
parent0fa94a0dddfc38635abf49a38dbadc9b9ead4d7a (diff)
downloadgitlab-ce-3899d07f9eb5ffa2369195c800be18e297f67613.tar.gz
Move hostname to Gitlab::Environment
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