Module: Gitlab::ShellEnv

Extended by:
ShellEnv
Included in:
ShellEnv
Defined in:
lib/gitlab/backend/shell_env.rb

Overview

This module provide 2 methods to set specific ENV variables for GitLab Shell

Instance Method Summary collapse

Instance Method Details

#gl_id(user) ⇒ Object


19
20
21
22
23
24
25
26
# File 'lib/gitlab/backend/shell_env.rb', line 19

def gl_id(user)
  if user.present?
    "user-#{user.id}"
  else
    # This empty string is used in the render_grack_auth_ok method
    ""
  end
end

#reset_envObject


14
15
16
17
# File 'lib/gitlab/backend/shell_env.rb', line 14

def reset_env
  # Reset GL_ID env variable
  ENV['GL_ID'] = nil
end

#set_env(user) ⇒ Object


7
8
9
10
11
12
# File 'lib/gitlab/backend/shell_env.rb', line 7

def set_env(user)
  # Set GL_ID env variable
  if user
    ENV['GL_ID'] = gl_id(user)
  end
end