From 448eab50bfbb70988250bd708ec3394a5a5a226a Mon Sep 17 00:00:00 2001 From: root Date: Fri, 14 Jul 2023 11:57:56 +0000 Subject: [PATCH] Removed .env file and fixed scripts to use /etc/federated --- bin/.env | 26 -------------------------- bin/backuptool | 14 +++++++------- bin/dumpcerts | 2 +- bin/install-federated | 16 ++++++++-------- bin/start | 2 +- 5 files changed, 17 insertions(+), 43 deletions(-) delete mode 100755 bin/.env diff --git a/bin/.env b/bin/.env deleted file mode 100755 index d9d7a5d..0000000 --- a/bin/.env +++ /dev/null @@ -1,26 +0,0 @@ -# Domain name -DOMAIN="f11230a1.federatedcomputer.cloud" - -# Company name -COMPANY="f11230a1 Federated Core" - -# Country Code (US, HK, GB, JP, etc) -COUNTRY="US" - -# Where to send welcome e-mail -EMAIL="derek@federated.computer" - -# Admin password -ADMINPASS="password123" - -# Listmonk password -LISTMONKPASS="password123" - -# Backblaze KeyID (Master Key) for backups -B2_APPLICATION_KEY_ID="3239c6765fdc" - -# Backblaze Application Key for backups -B2_APPLICATION_KEY="0050ac8837466cbca0e0aa574b5f8332f706a5e26c" - -# Email address for alerts on services that fail to start -ALERTS_EMAIL="alerts@federated.computer" diff --git a/bin/backuptool b/bin/backuptool index 9033db7..2bf4743 100755 --- a/bin/backuptool +++ b/bin/backuptool @@ -144,14 +144,14 @@ else echo "$GPG_PASSPHRASE" > /federated/bin/.gpg.backblaze fi -if [ -f "/federated/bin/.env" ]; then - . /federated/bin/.env - [ -z "$B2_APPLICATION_KEY_ID" ] && failcheck "/federated/bin/.env doesn't include B2_APPLICATION_KEY_ID for backups" - [ -z "$B2_APPLICATION_KEY" ] && failcheck "/federated/bin/.env doesn't include B2_APPLICATION_KEY for backups" - [ -z "$DOMAIN" ] && failcheck "/federated/bin/.env doesn't include DOMAIN for backups" - UUID=`cat /federated/bin/.env | grep DOMAIN | awk -F\. '{ print $1 }' | awk -F\" '{ print $2 }'` +if [ -f "/etc/federated" ]; then + . /etc/federated + [ -z "$B2_APPLICATION_KEY_ID" ] && failcheck "/etc/federated doesn't include B2_APPLICATION_KEY_ID for backups" + [ -z "$B2_APPLICATION_KEY" ] && failcheck "/etc/federated doesn't include B2_APPLICATION_KEY for backups" + [ -z "$DOMAIN" ] && failcheck "/etc/federated doesn't include DOMAIN for backups" + UUID=`cat /etc/federated | grep DOMAIN | awk -F\. '{ print $1 }' | awk -F\" '{ print $2 }'` else - failcheck "Could not find an .env file." + failcheck "Could not find an /etc/federated file." fi [ -f "/federated/bin/.b2init" ] && UUID=`cat /federated/bin/.b2init` diff --git a/bin/dumpcerts b/bin/dumpcerts index 8987b30..4aae5f2 100755 --- a/bin/dumpcerts +++ b/bin/dumpcerts @@ -11,7 +11,7 @@ fail() { exit 2; } -. /federated/bin/.env +. /etc/federated echo -ne "\n* Dumping certs from traefik into /federated/certs.." diff --git a/bin/install-federated b/bin/install-federated index af81578..5c6bd07 100755 --- a/bin/install-federated +++ b/bin/install-federated @@ -42,18 +42,18 @@ get_config() { COUNTRIES=("AF" "AL" "DZ" "AS" "AD" "AO" "AI" "AQ" "AG" "AR" "AM" "AW" "AU" "AT" "AZ" "BS" "BH" "BD" "BB" "BY" "BE" "BZ" "BJ" "BM" "BT" "BO" "BO" "BA" "BW" "BV" "BR" "IO" "BN" "BN" "BG" "BF" "BI" "KH" "CM" "CA" "CV" "KY" "CF" "TD" "CL" "CN" "CX" "CC" "CO" "KM" "CG" "CD" "CK" "CR" "CI" "CI" "HR" "CU" "CY" "CZ" "DK" "DJ" "DM" "DO" "EC" "EG" "SV" "GQ" "ER" "EE" "ET" "FK" "FO" "FJ" "FI" "FR" "GF" "PF" "TF" "GA" "GM" "GE" "DE" "GH" "GI" "GR" "GL" "GD" "GP" "GU" "GT" "GG" "GN" "GW" "GY" "HT" "HM" "VA" "HN" "HK" "HU" "IS" "IN" "ID" "IR" "IQ" "IE" "IM" "IL" "IT" "JM" "JP" "JE" "JO" "KZ" "KE" "KI" "KP" "KR" "KR" "KW" "KG" "LA" "LV" "LB" "LS" "LR" "LY" "LY" "LI" "LT" "LU" "MO" "MK" "MG" "MW" "MY" "MV" "ML" "MT" "MH" "MQ" "MR" "MU" "YT" "MX" "FM" "MD" "MC" "MN" "ME" "MS" "MA" "MZ" "MM" "MM" "NA" "NR" "NP" "NL" "AN" "NC" "NZ" "NI" "NE" "NG" "NU" "NF" "MP" "NO" "OM" "PK" "PW" "PS" "PA" "PG" "PY" "PE" "PH" "PN" "PL" "PT" "PR" "QA" "RE" "RO" "RU" "RU" "RW" "SH" "KN" "LC" "PM" "VC" "VC" "VC" "WS" "SM" "ST" "SA" "SN" "RS" "SC" "SL" "SG" "SK" "SI" "SB" "SO" "ZA" "GS" "SS" "ES" "LK" "SD" "SR" "SJ" "SZ" "SE" "CH" "SY" "TW" "TW" "TJ" "TZ" "TH" "TL" "TG" "TK" "TO" "TT" "TN" "TR" "TM" "TC" "TV" "UG" "UA" "AE" "GB" "US" "UM" "UY" "UZ" "VU" "VE" "VE" "VN" "VN" "VG" "VI" "WF" "EH" "YE" "ZM" "ZW") - if [ -f "/federated/bin/.env" ]; then - . /federated/bin/.env - [ -z "$DOMAIN" ] && failcheck "/federated/bin/.env doesn't include DOMAIN" - [ -z "$COMPANY" ] && failcheck "/federated/bin/.env doesn't include COMPANY" - [ -z "$COUNTRY" ] && failcheck "/federated/bin/.env doesn't include COUNTRY" + if [ -f "/etc/federated" ]; then + . /etc/federated + [ -z "$DOMAIN" ] && failcheck "/etc/federated doesn't include DOMAIN" + [ -z "$COMPANY" ] && failcheck "/etc/federated doesn't include COMPANY" + [ -z "$COUNTRY" ] && failcheck "/etc/federated doesn't include COUNTRY" if ! printf '%s\0' "${COUNTRIES[@]}" | grep -Fxqz -- "$COUNTRY"; then failcheck "$COUNTRY is not a valid country code. Use US, GB, HK, etc" fi - [ -z "$B2_APPLICATION_KEY_ID" ] && echo -ne "\nWarning: B2_APPLICATION_KEY_ID doesn't exist in .env\nBackups will be disabled" - [ -z "$B2_APPLICATION_KEY" ] && echo -ne "\nWarning: B2_APPLICATION_KEY doesn't exist in .env\nBackups will be disabled" + [ -z "$B2_APPLICATION_KEY_ID" ] && echo -ne "\nWarning: B2_APPLICATION_KEY_ID doesn't exist in /etc/federated\nBackups will be disabled" + [ -z "$B2_APPLICATION_KEY" ] && echo -ne "\nWarning: B2_APPLICATION_KEY doesn't exist in /etc/federated\nBackups will be disabled" else - failcheck "/federated/bin/.env doesn't exist" + failcheck "/etc/federated doesn't exist" fi # Setup DOMAIN variable for domain or subdomain diff --git a/bin/start b/bin/start index 4c1cf8e..59f0619 100755 --- a/bin/start +++ b/bin/start @@ -2,7 +2,7 @@ # # Federated Start Script . /federated/lib/functions.sh -. /federated/bin/.env +. /etc/federated usage() { printf -v SERVICES_JOINED '%s|' "${SERVICES[@]}"