blob: 19351b2202c920741a1394b6944384435ee9fc47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/bash
set -eu
# Get database settings from dbconfig-common and write libeufin configuration files.
if [ -f /etc/dbconfig-common/libeufin-nexus.conf ]; then
. /etc/dbconfig-common/libeufin-nexus.conf
case "$dbc_dbtype" in
pgsql)
# We assume ident auth here. We might support password auth later.
mkdir -p /etc/libeufin/
echo -e "LIBEUFIN_NEXUS_PORT=5017" > \
/etc/libeufin/nexus.env
echo -e "LIBEUFIN_NEXUS_DB_CONNECTION=\"jdbc:postgresql://${dbc_dbserver}/${dbc_dbname}?user=${dbc_dbuser}&password=${dbc_dbpass}\"\n\n" >> \
/etc/libeufin/nexus.env
# Allow the libeufin-sandbox/nexus user to create schemas.
echo "GRANT CREATE ON DATABASE \"${dbc_dbname}\" TO \"libeufin-nexus\";" | sudo -u postgres psql -f -
;;
sqlite3)
# Later: use something like:
# sqlite:///$DATA_DIR/libeufin.db
# But for now, sqlite is unsupported:
echo "Unsupported database type $dbc_type."
exit 1
;;
"") ;;
*)
echo "Unsupported database type $dbc_type."
exit 1
;;
esac
fi
|