Commit c698bc7d9e27c2fcf2f9b01b50ee35fed33fd564

Authored by Dmitriy Zaporozhets
2 parents cd5685ca 719f7231

Merge pull request #4037 from mitchty/master

Remove user directory path assumptions
Showing 1 changed file with 7 additions and 2 deletions   Show diff stats
config/initializers/1_settings.rb
... ... @@ -60,6 +60,11 @@ Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
60 60 Settings.gitlab['support_email'] ||= Settings.gitlab.email_from
61 61 Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
62 62 Settings.gitlab['user'] ||= 'git'
  63 +Settings.gitlab['user_home'] ||= begin
  64 + Etc.getpwnam(Settings.gitlab['user']).dir
  65 +rescue ArgumentError # no user configured
  66 + '/home/' + Settings.gitlab['user']
  67 +end
63 68 Settings.gitlab['signup_enabled'] ||= false
64 69 Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil?
65 70 Settings.gitlab['default_projects_features'] ||= {}
... ... @@ -81,10 +86,10 @@ Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?
81 86 # GitLab Shell
82 87 #
83 88 Settings['gitlab_shell'] ||= Settingslogic.new({})
84   -Settings.gitlab_shell['hooks_path'] ||= '/home/git/gitlab-shell/hooks/'
  89 +Settings.gitlab_shell['hooks_path'] ||= Settings.gitlab['user_home'] + '/gitlab-shell/hooks/'
85 90 Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil?
86 91 Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil?
87   -Settings.gitlab_shell['repos_path'] ||= '/home/git/repositories/'
  92 +Settings.gitlab_shell['repos_path'] ||= Settings.gitlab['user_home'] + '/repositories/'
88 93 Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
89 94 Settings.gitlab_shell['ssh_port'] ||= 22
90 95 Settings.gitlab_shell['ssh_user'] ||= Settings.gitlab.user
... ...