Merge branch 'remove-shell-env' into 'master'

Get rid of Gitlab::ShellEnv

Remove obsolete code we once needed for Grack and satellites.

See merge request !4673
This commit is contained in:
Douwe Maan 2016-06-15 16:41:13 +00:00
commit af493ccf36
5 changed files with 13 additions and 37 deletions

View file

@ -3,7 +3,7 @@ class GitHooksService
def execute(user, repo_path, oldrev, newrev, ref)
@repo_path = repo_path
@user = Gitlab::ShellEnv.gl_id(user)
@user = Gitlab::GlId.gl_id(user)
@oldrev = oldrev
@newrev = newrev
@ref = ref

View file

@ -1,5 +1,3 @@
require_relative 'shell_env'
module Grack
class AuthSpawner
def self.call(env)
@ -61,11 +59,6 @@ module Grack
end
@user = authenticate_user(login, password)
if @user
Gitlab::ShellEnv.set_env(@user)
@env['REMOTE_USER'] = @auth.username
end
end
def ci_request?(login, password)

View file

@ -1,28 +0,0 @@
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
if user
ENV['GL_ID'] = gl_id(user)
end
end
def reset_env
# Reset GL_ID env variable
ENV['GL_ID'] = nil
end
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
end
end

11
lib/gitlab/gl_id.rb Normal file
View file

@ -0,0 +1,11 @@
module Gitlab
module GlId
def self.gl_id(user)
if user.present?
"user-#{user.id}"
else
""
end
end
end
end

View file

@ -8,7 +8,7 @@ module Gitlab
class << self
def git_http_ok(repository, user)
{
'GL_ID' => Gitlab::ShellEnv.gl_id(user),
'GL_ID' => Gitlab::GlId.gl_id(user),
'RepoPath' => repository.path_to_repo,
}
end