|
|
@ -22,6 +22,7 @@ USER=$(relation-get user) || { |
|
|
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
## YYY: check that password was not already generated/set for the same user |
|
|
|
## use session state storage. |
|
|
|
|
|
|
@ -47,12 +48,20 @@ fi |
|
|
|
|
|
|
|
array_read-0 extensions < <(relation-get extensions 2>/dev/null | shyaml get-values-0) |
|
|
|
|
|
|
|
|
|
|
|
ensure_db_docker_running |
|
|
|
|
|
|
|
## XXXvlab: should send all these into only one docker... |
|
|
|
if ! db_has_database "$DBNAME"; then |
|
|
|
db_create "$DBNAME" || exit 1 |
|
|
|
|
|
|
|
INITDB_ARGS=(encoding lc-collate lc-ctype template) |
|
|
|
CREATEDB_OPTS=() |
|
|
|
for option in "${INITDB_ARGS[@]}"; do |
|
|
|
value="$(relation-get "$option" 2>/dev/null)" || true |
|
|
|
if [ -n "$value" ]; then |
|
|
|
CREATEDB_OPTS+=("--$option=$value") |
|
|
|
fi |
|
|
|
done |
|
|
|
db_create "$DBNAME" "${CREATEDB_OPTS[@]}" || exit 1 |
|
|
|
if sql=$(relation-get init-sql); then |
|
|
|
ddb "$DBNAME" > /dev/null < <(e "$sql") || exit 1 |
|
|
|
fi |
|
|
|