Add missing env var (#1309)

Makes the telem vars more robust
This commit is contained in:
Jamil
2023-01-13 17:30:09 -08:00
committed by GitHub
parent ec321c5619
commit 5320596cec
3 changed files with 7 additions and 8 deletions

View File

@@ -41,9 +41,13 @@ if config_env() == :prod do
live_view_signing_salt = System.fetch_env!("LIVE_VIEW_SIGNING_SALT")
cookie_signing_salt = System.fetch_env!("COOKIE_SIGNING_SALT")
cookie_encryption_salt = System.fetch_env!("COOKIE_ENCRYPTION_SALT")
telemetry_id = System.fetch_env!("TELEMETRY_ID")
# OPTIONAL
# telemetry env var name was renamed; use newer one if exists
telemetry_id = System.get_env("TID", System.get_env("TELEMETRY_ID", "unknown"))
telemetry_enabled = FzString.to_boolean(System.get_env("TELEMETRY_ENABLED", "true"))
wireguard_private_key_path =
System.get_env("WIREGUARD_PRIVATE_KEY_PATH", "/var/firezone/private_key")
@@ -82,8 +86,6 @@ if config_env() == :prod do
wireguard_ipv6_network = System.get_env("WIREGUARD_IPV6_NETWORK", "fd00::3:2:0/120")
wireguard_ipv6_address = System.get_env("WIREGUARD_IPV6_ADDRESS", "fd00::3:2:1")
telemetry_enabled = FzString.to_boolean(System.get_env("TELEMETRY_ENABLED", "true"))
cookie_secure = FzString.to_boolean(System.get_env("SECURE_COOKIES", "true"))
# Outbound Email

View File

@@ -34,10 +34,7 @@ add_routes()
setup_telemetry() {
[ -f /var/firezone/.tid ] || cat /proc/sys/kernel/random/uuid > /var/firezone/.tid
telem_id=$(cat /var/firezone/.tid)
# Try to use $TID from install script, otherwise fallback to old .tid
export TELEMETRY_ID=${TID:-$telem_id}
export TELEMETRY_ID=$(cat /var/firezone/.tid)
}
gen_cert() {

View File

@@ -161,7 +161,7 @@ firezoneSetup() {
echo "Resetting DB password..."
$dc -f $installDir/docker-compose.yml exec postgres psql -p 5432 -U postgres -d firezone -h 127.0.0.1 -c "ALTER ROLE postgres WITH PASSWORD '${db_pass}'"
echo "Creating admin..."
$dc -f $installDir/docker-compose.yml run --rm firezone bin/create-or-reset-admin
$dc -f $installDir/docker-compose.yml run -e TELEMETRY_ID="${tid}" --rm firezone bin/create-or-reset-admin
echo "Upping firezone services..."
$dc -f $installDir/docker-compose.yml up -d firezone caddy