Commit 6d6f13ef37fb715fa0171ddbe1d44d22c06cab24
1 parent
ff70ee4b
Exists in
master
and in
17 other branches
Set/store the secret_token in gitlab_secrets.json
We generate 64 characters because that is what we also do in https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/initializers/secret_token.rb
Showing
2 changed files
with
5 additions
and
0 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
| @@ -48,6 +48,7 @@ module Gitlab | @@ -48,6 +48,7 @@ module Gitlab | ||
| 48 | end | 48 | end |
| 49 | 49 | ||
| 50 | Gitlab['postgresql']['sql_password'] ||= generate_hex(50) | 50 | Gitlab['postgresql']['sql_password'] ||= generate_hex(50) |
| 51 | + Gitlab['gitlab-core']['secret_token'] ||= generate_hex(64) | ||
| 51 | 52 | ||
| 52 | if File.directory?("/etc/gitlab") | 53 | if File.directory?("/etc/gitlab") |
| 53 | File.open("/etc/gitlab/gitlab-secrets.json", "w") do |f| | 54 | File.open("/etc/gitlab/gitlab-secrets.json", "w") do |f| |
| @@ -56,6 +57,9 @@ module Gitlab | @@ -56,6 +57,9 @@ module Gitlab | ||
| 56 | 'postgresql' => { | 57 | 'postgresql' => { |
| 57 | 'sql_password' => Gitlab['postgresql']['sql_password'], | 58 | 'sql_password' => Gitlab['postgresql']['sql_password'], |
| 58 | }, | 59 | }, |
| 60 | + 'gitlab-core' => { | ||
| 61 | + 'secret_token' => Gitlab['gitlab-core']['secret_token'], | ||
| 62 | + } | ||
| 59 | }) | 63 | }) |
| 60 | ) | 64 | ) |
| 61 | system("chmod 0600 /etc/gitlab/gitlab-secrets.json") | 65 | system("chmod 0600 /etc/gitlab/gitlab-secrets.json") |
files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb
0 → 100644
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| 1 | +<%= @secret_token %> |