From 43736cd8e9c78d970af99898e5aab77ba974bfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Wed, 25 Mar 2020 17:51:28 +0100 Subject: [PATCH] Move the debug logs env variable to an attribute Set it to 'sockethub*' for now as Nick advised, see https://gitea.kosmos.org/kosmos/chef/issues/91 --- site-cookbooks/sockethub/attributes/default.rb | 1 + site-cookbooks/sockethub/recipes/default.rb | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/site-cookbooks/sockethub/attributes/default.rb b/site-cookbooks/sockethub/attributes/default.rb index c3a9599..5d74c1a 100644 --- a/site-cookbooks/sockethub/attributes/default.rb +++ b/site-cookbooks/sockethub/attributes/default.rb @@ -2,3 +2,4 @@ node.default['sockethub']['port'] = '10551' node.default['sockethub']['external_port'] = '10550' node.default['sockethub']['version'] = '3.1.4' node.default['sockethub']['nginx']['server_name'] = 'sockethub.kosmos.org' +node.default['sockethub']['debug_logs'] = 'sockethub*' diff --git a/site-cookbooks/sockethub/recipes/default.rb b/site-cookbooks/sockethub/recipes/default.rb index 156ada0..052a927 100644 --- a/site-cookbooks/sockethub/recipes/default.rb +++ b/site-cookbooks/sockethub/recipes/default.rb @@ -48,6 +48,15 @@ execute "systemctl daemon-reload" do action :nothing end +environment_variables = { + 'PORT' => node['sockethub']['port'], + # Use the second database (index starts at 0) + 'REDIS_URL' => "redis://localhost:6379/1" +} +unless node['sockethub']['debug_logs'].nil? + environment_variables['DEBUG'] = node['sockethub']['debug_logs'] +end + template "/lib/systemd/system/sockethub_nodejs.service" do source 'nodejs.systemd.service.erb' owner 'root' @@ -57,10 +66,7 @@ template "/lib/systemd/system/sockethub_nodejs.service" do user: "sockethub", group: "sockethub", entry: "/usr/bin/sockethub", - environment: { 'DEBUG' => '*', - 'PORT' => node['sockethub']['port'], - # Use the second database (index starts at 0) - 'REDIS_URL' => "redis://localhost:6379/1" } + environment: environment_variables ) notifies :run, "execute[systemctl daemon-reload]", :delayed notifies :restart, "service[sockethub_nodejs]", :delayed