Remove the condition on the postgresql

Also move back the environment variable definitions to the hash
This commit is contained in:
Greg Karekinian 2025-06-25 09:51:35 +02:00
parent efb032fffa
commit 89fa3ede9e

View File

@ -74,8 +74,7 @@ if node["nbxplorer"]["postgres"]
nbxpg_connect = "User ID=#{nbxpg_user};Password=#{nbxplorer_credentials['postgresql_password']};Database=#{nbxpg_database};Host=pg.kosmos.local;Port=5432;Application Name=btcpayserver;MaxPoolSize=80"
end
systemd_unit_env = "'DOTNET_CLI_TELEMETRY_OPTOUT=1'"
systemd_unit_env << " 'BTCPAY_EXPLORERPOSTGRES=#{nbxpg_connect}'" if defined?(nbxpg_connect)
systemd_unit_env = "'BTCPAY_EXPLORERPOSTGRES=#{nbxpg_connect}' 'DOTNET_CLI_TELEMETRY_OPTOUT=1'"
systemd_unit 'btcpayserver.service' do
content({
Unit: {
@ -89,7 +88,7 @@ systemd_unit 'btcpayserver.service' do
Group: node['bitcoin']['usergroup'],
Type: 'simple',
WorkingDirectory: node['btcpay']['source_dir'],
Environment: systemd_unit_env,
Environment: "'BTCPAY_EXPLORERPOSTGRES=#{nbxpg_connect}' 'DOTNET_CLI_TELEMETRY_OPTOUT=1'",
ExecStart: "#{node['btcpay']['source_dir']}/run.sh --conf=#{node['btcpay']['config_path']}",
PIDFile: '/run/btcpayserver/btcpayserver.pid',
Restart: 'on-failure',