atst/script/include/get_db_settings_functions.inc.sh
dandds beabd2ce72 Remove the scriptz submodule and hard-commit the files.
The submodule is a leftover from when this project was intended to work
as a series of microservices. It was meant to provide common
functionality to the builds for every microservice. That's no longer the
case, and the submodule is a pain-point both in on-boarding new
developers and running the Docker build.
2019-07-14 16:01:13 -04:00

16 lines
492 B
Bash

# set_db_env_vars.inc.sh: Functions used by the set_db_env_vars script
set_db_env_vars () {
local config_file="${1}"
# Read in and export all name=value pairs where the name starts with PG
# unless we already have an env var with that value
# (NOTE: all whitespaces are removed from each line)
while read -r DBVAR
do
if ! $(env | grep -qFle "${DBVAR%%=*}"); then
eval "export ${DBVAR}"
fi
done < <(grep -Ee '^PG' "${config_file}" | sed 's/ //g')
}