Commit eb1c9312841c953a59e8a1eedaebb5f9af850bd0
1 parent
aa428b11
Exists in
master
and in
9 other branches
Support changing user in gitlab.yml
The cookbooks will let you change the git user by setting user['username'] = "gitlab" in gitlab.rb, but they don't also change the username in gitlab.yml. This commit makes sure those are in sync, while giving the admin the ability to have them differ if they want.
Showing
3 changed files
with
9 additions
and
1 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/attributes/default.rb
... | ... | @@ -53,6 +53,7 @@ default['gitlab']['gitlab-rails']['rate_limit_period'] = 60 |
53 | 53 | default['gitlab']['gitlab-rails']['gitlab_host'] = node['fqdn'] |
54 | 54 | default['gitlab']['gitlab-rails']['gitlab_port'] = 80 |
55 | 55 | default['gitlab']['gitlab-rails']['gitlab_https'] = false |
56 | +default['gitlab']['gitlab-rails']['gitlab_user'] = default['gitlab']['user']['username'] | |
56 | 57 | default['gitlab']['gitlab-rails']['gitlab_email_from'] = "gitlab@#{node['fqdn']}" |
57 | 58 | default['gitlab']['gitlab-rails']['gitlab_support_email'] = "support@localhost" |
58 | 59 | default['gitlab']['gitlab-rails']['gitlab_default_projects_limit'] = 10 | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
... | ... | @@ -24,6 +24,13 @@ gitlab_rails_tmp_dir = File.join(gitlab_rails_dir, "tmp") |
24 | 24 | gitlab_rails_public_uploads_dir = node['gitlab']['gitlab-rails']['uploads_directory'] |
25 | 25 | gitlab_rails_log_dir = node['gitlab']['gitlab-rails']['log_directory'] |
26 | 26 | |
27 | +# in gitlab.yml, use the main gitlab username if the admin did | |
28 | +# not specifically set gitlab_user | |
29 | +if node['gitlab']['gitlab-rails']['gitlab_user'] == | |
30 | + node.default['gitlab']['gitlab-rails']['gitlab_user'] | |
31 | + node.set['gitlab']['gitlab-rails']['gitlab_user'] = node['gitlab']['user']['username'] | |
32 | +end | |
33 | + | |
27 | 34 | [ |
28 | 35 | gitlab_rails_dir, |
29 | 36 | gitlab_rails_etc_dir, | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb
... | ... | @@ -24,7 +24,7 @@ production: &base |
24 | 24 | # relative_url_root: /gitlab |
25 | 25 | |
26 | 26 | # Uncomment and customize if you can't use the default user to run GitLab (default: 'git') |
27 | - # user: git | |
27 | + user: <%= @gitlab_user %> | |
28 | 28 | |
29 | 29 | ## Email settings |
30 | 30 | # Email address used in the "From" field in mails sent by GitLab | ... | ... |