feat: add SQL container init script
This commit is contained in:
parent
7439475766
commit
de7ed2a996
1 changed files with 14 additions and 0 deletions
14
misc/init-sql.sh
Normal file
14
misc/init-sql.sh
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue