From 6d6f13ef37fb715fa0171ddbe1d44d22c06cab24 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 4 Feb 2014 17:20:16 +0100 Subject: [PATCH] Set/store the secret_token in gitlab_secrets.json --- files/gitlab-cookbooks/gitlab/libraries/gitlab.rb | 4 ++++ files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb | 1 + 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb diff --git a/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb b/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb index 4d0c66d..9c6609c 100644 --- a/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb +++ b/files/gitlab-cookbooks/gitlab/libraries/gitlab.rb @@ -48,6 +48,7 @@ module Gitlab end Gitlab['postgresql']['sql_password'] ||= generate_hex(50) + Gitlab['gitlab-core']['secret_token'] ||= generate_hex(64) if File.directory?("/etc/gitlab") File.open("/etc/gitlab/gitlab-secrets.json", "w") do |f| @@ -56,6 +57,9 @@ module Gitlab 'postgresql' => { 'sql_password' => Gitlab['postgresql']['sql_password'], }, + 'gitlab-core' => { + 'secret_token' => Gitlab['gitlab-core']['secret_token'], + } }) ) system("chmod 0600 /etc/gitlab/gitlab-secrets.json") diff --git a/files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb b/files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb new file mode 100644 index 0000000..e05f234 --- /dev/null +++ b/files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb @@ -0,0 +1 @@ +<%= @secret_token %> -- libgit2 0.21.2