Opt-out of dotnet telemetry for btcpay

This is done by setting an environment variable in the systemd unit

Fixes #441
This commit is contained in:
Greg Karekinian 2025-06-24 16:53:59 +02:00
parent 364adec80f
commit efb032fffa

View File

@ -74,6 +74,8 @@ 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 'btcpayserver.service' do
content({
Unit: {
@ -87,7 +89,7 @@ systemd_unit 'btcpayserver.service' do
Group: node['bitcoin']['usergroup'],
Type: 'simple',
WorkingDirectory: node['btcpay']['source_dir'],
Environment: defined?(nbxpg_connect) ? "'BTCPAY_EXPLORERPOSTGRES=#{nbxpg_connect}'" : '',
Environment: systemd_unit_env,
ExecStart: "#{node['btcpay']['source_dir']}/run.sh --conf=#{node['btcpay']['config_path']}",
PIDFile: '/run/btcpayserver/btcpayserver.pid',
Restart: 'on-failure',
@ -103,6 +105,7 @@ systemd_unit 'btcpayserver.service' do
verify false
triggers_reload true
action [:create]
notifies :reload, "systemd_unit[btcpayserver.service]", :delayed
end
service "btcpayserver" do