From de7ed2a996f33117f06c8a4c9aabb321637d433b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20BENO=C3=8ET?= Date: Thu, 2 Jan 2025 14:06:25 +0100 Subject: [PATCH] feat: add SQL container init script --- misc/init-sql.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 misc/init-sql.sh diff --git a/misc/init-sql.sh b/misc/init-sql.sh new file mode 100644 index 0000000..0690512 --- /dev/null +++ b/misc/init-sql.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e +cd /opt/lwsql +for var_name in `sed '/^.getenv/!d;s/.* //' INSTALL.sql`; do + echo "Checking variable $var_name" >&2 + file_var_name="${var_name}_FILE" + eval file_var_value="\"\$$file_var_name\"" + if [ ! -z "$file_var_value" ]; then + echo " -> Reading $var_name from $file_var_value" >&2 + eval "export $var_name=\"`cat $file_var_value`\"" + fi +done +psql -f INSTALL.sql