From 4b389cb5c38d7e499e718ad90db5c93b293019d1 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 9 Oct 2020 11:51:00 +0000 Subject: [PATCH] feat(config): add secrets.cfg --- .../config-lgsm/common-secrets-template.cfg | 5 +++++ .../config-lgsm/instance-secrets-template.cfg | 5 +++++ linuxgsm.sh | 18 ++++++++++++++++++ tests/tests_fctrserver.sh | 18 ++++++++++++++++++ tests/tests_jc2server.sh | 18 ++++++++++++++++++ tests/tests_mcserver.sh | 18 ++++++++++++++++++ tests/tests_ts3server.sh | 18 ++++++++++++++++++ 7 files changed, 100 insertions(+) create mode 100644 lgsm/config-default/config-lgsm/common-secrets-template.cfg create mode 100644 lgsm/config-default/config-lgsm/instance-secrets-template.cfg diff --git a/lgsm/config-default/config-lgsm/common-secrets-template.cfg b/lgsm/config-default/config-lgsm/common-secrets-template.cfg new file mode 100644 index 000000000..efc6776d9 --- /dev/null +++ b/lgsm/config-default/config-lgsm/common-secrets-template.cfg @@ -0,0 +1,5 @@ +################################## +######## Common Secrets ########## +################################## +# PLACE SECRET SETTINGS HERE +## These settings will apply to all instances. diff --git a/lgsm/config-default/config-lgsm/instance-secrets-template.cfg b/lgsm/config-default/config-lgsm/instance-secrets-template.cfg new file mode 100644 index 000000000..dcc6411e4 --- /dev/null +++ b/lgsm/config-default/config-lgsm/instance-secrets-template.cfg @@ -0,0 +1,5 @@ +################################## +####### Instance Secrets ######### +################################## +# PLACE SECRET SETTINGS HERE +## These settings will apply to all instances. diff --git a/linuxgsm.sh b/linuxgsm.sh index 67f24da3f..c6dabef02 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -411,6 +411,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi + # Load the common-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/common-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "common-secrets-template.cfg" "${configdirserver}" "common-secrets.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" @@ -420,6 +429,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi + # Load the instance-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/${selfname}-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "instance-secrets-template.cfg" "${configdirserver}" "${selfname}-secrets.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + fi # Load the linuxgsm.sh in to tmpdir. If missing download it. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 8856a63b9..18909d216 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -420,6 +420,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi + # Load the common-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/common-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "common-secrets-template.cfg" "${configdirserver}" "common-secrets.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" @@ -429,6 +438,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi + # Load the instance-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/${selfname}-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "instance-secrets-template.cfg" "${configdirserver}" "${selfname}-secrets.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + fi # Load the linuxgsm.sh in to tmpdir. If missing download it. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index dca188aef..f8613dd9d 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -421,6 +421,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi + # Load the common-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/common-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "common-secrets-template.cfg" "${configdirserver}" "common-secrets.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" @@ -430,6 +439,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi + # Load the instance-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/${selfname}-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "instance-secrets-template.cfg" "${configdirserver}" "${selfname}-secrets.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + fi # Load the linuxgsm.sh in to tmpdir. If missing download it. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 71b45f34a..50848e79b 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -421,6 +421,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi + # Load the common-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/common-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "common-secrets.cfg" "${configdirserver}" "common-secrets.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" @@ -430,6 +439,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi + # Load the instance-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/${selfname}-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "instance-secrets-template.cfg" "${configdirserver}" "${selfname}-secrets.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + fi # Load the linuxgsm.sh in to tmpdir. If missing download it. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index c9756c331..57d60199b 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -421,6 +421,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/common.cfg" fi + # Load the common-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/common-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "common-secrets-template.cfg" "${configdirserver}" "common-secrets.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/common-secrets.cfg" + fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" @@ -430,6 +439,15 @@ else # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" fi + # Load the instance-secrets.cfg config. If missing download it. + if [ ! -f "${configdirserver}/${selfname}-secrets.cfg" ]; then + fn_fetch_config "lgsm/config-default/config-lgsm" "instance-secrets-template.cfg" "${configdirserver}" "${selfname}-secrets.cfg" "nochmodx" "norun" "noforcedl" "nomd5" + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + else + # shellcheck source=/dev/null + source "${configdirserver}/${selfname}-secrets.cfg" + fi # Load the linuxgsm.sh in to tmpdir. If missing download it. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then