From d4bd1faec41cdba5ea7771774d7fe1f5852b63c1 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Wed, 26 Feb 2020 00:50:05 -0600 Subject: [PATCH] Remove secrets --- .gitignore | 1 + lib/env.bash | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81a38be --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env* diff --git a/lib/env.bash b/lib/env.bash index 651a602..68c07de 100755 --- a/lib/env.bash +++ b/lib/env.bash @@ -1,10 +1,21 @@ #!/bin/bash +# Bash env file with host specific secrets +LIBGLM_SECRETS_FILE=$LIBGLM_ROOT/.env.bash + +# Get the value of the specified variable in the secrets file. +# $1 - the name of the secrets variable - (e.g. FOOBAR corresponds to LIBGLM_SECRET_FOOBAR in the file) +function env_get_secret { + source $LIBGLM_SECRETS_FILE + local varname="LIBGLM_SECRET_$1" + echo ${!varname} +} + # Fully qualified URL to the Gotify server. Should not end with a /. -NOTIFY_URL="https://notify.garrettmills.dev" +NOTIFY_URL="$(env_get_secret NOTIFY_URL)" # App token to use for the Gotify server. -NOTIFY_TOKEN="A1dyzPhND7Bq7v_" +NOTIFY_TOKEN="$(env_get_secret NOTIFY_TOKEN)" # The current hostname LIBGLM_HOSTNAME=$(hostname)