debian-mirror-gitlab/lib/gitlab/backend/shell_env.rb

29 lines
530 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module Gitlab
# This module provide 2 methods
# to set specific ENV variables for GitLab Shell
module ShellEnv
extend self
def set_env(user)
# Set GL_ID env variable
2015-09-11 14:41:01 +05:30
if user
ENV['GL_ID'] = gl_id(user)
end
2014-09-02 18:07:02 +05:30
end
def reset_env
# Reset GL_ID env variable
ENV['GL_ID'] = nil
end
2015-09-11 14:41:01 +05:30
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
2014-09-02 18:07:02 +05:30
end
end