Commit 6d6f13ef37fb715fa0171ddbe1d44d22c06cab24

Authored by Jacob Vosmaer
1 parent ff70ee4b

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
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
... ... @@ -48,6 +48,7 @@ module Gitlab
48 48 end
49 49  
50 50 Gitlab['postgresql']['sql_password'] ||= generate_hex(50)
  51 + Gitlab['gitlab-core']['secret_token'] ||= generate_hex(64)
51 52  
52 53 if File.directory?("/etc/gitlab")
53 54 File.open("/etc/gitlab/gitlab-secrets.json", "w") do |f|
... ... @@ -56,6 +57,9 @@ module Gitlab
56 57 'postgresql' => {
57 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 65 system("chmod 0600 /etc/gitlab/gitlab-secrets.json")
... ...
files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb 0 → 100644
... ... @@ -0,0 +1 @@
  1 +<%= @secret_token %>
... ...