Gitlab::ShellEnv added
This commit is contained in:
parent
b698094d4d
commit
49cf9badbc
4 changed files with 22 additions and 3 deletions
|
@ -32,8 +32,7 @@ module Grack
|
|||
self.user = User.find_by_email(login) || User.find_by_username(login)
|
||||
return false unless user.try(:valid_password?, password)
|
||||
|
||||
# Set GL_ID env variable
|
||||
ENV['GL_ID'] = "user-#{user.id}"
|
||||
Gitlab::ShellEnv.set_env(user)
|
||||
end
|
||||
|
||||
# Git upload and receive
|
||||
|
|
|
@ -53,7 +53,6 @@ module Gitlab
|
|||
system("/home/git/gitlab-shell/bin/gitlab-keys rm-key #{key_id} \"#{key_content}\"")
|
||||
end
|
||||
|
||||
|
||||
def url_to_repo path
|
||||
Gitlab.config.gitlab_shell.ssh_path_prefix + "#{path}.git"
|
||||
end
|
||||
|
|
17
lib/gitlab/backend/shell_env.rb
Normal file
17
lib/gitlab/backend/shell_env.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
module Gitlab
|
||||
# This module provide 2 methods
|
||||
# to set specific ENV variabled for GitLab Shell
|
||||
module ShellEnv
|
||||
extend self
|
||||
|
||||
def set_env(user)
|
||||
# Set GL_ID env variable
|
||||
ENV['GL_ID'] = "user-#{user.id}"
|
||||
end
|
||||
|
||||
def reset_env
|
||||
# Reset GL_ID env variable
|
||||
ENV['GL_ID'] = nil
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue