summaryrefslogtreecommitdiff
path: root/lib/gitlab/environment.rb
blob: 86094727df5e35fdfc00a85550f2d7f346904cfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Gitlab
  module Environment
    def self.hostname
      @hostname ||= ENV['HOSTNAME'] || Socket.gethostname
    end

    # Check whether codebase is going through static verification
    # in order to skip executing parts of the codebase
    #
    # @return [Boolean] Is the code going through static verification?
    def self.static_verification?
      static_verification = Gitlab::Utils.to_boolean(ENV['STATIC_VERIFICATION'], default: false)
      env_production = ENV['RAILS_ENV'] == 'production'

      warn '[WARNING] Static Verification bypass is enabled in Production.' if static_verification && env_production

      static_verification
    end
  end
end