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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# .env
#
# This file is sourced by scripts/sqlx_premigration.sh (if present).
# Any required variables not set here will cause the script to fail.
#
# SQLx notes:
# - sqlx uses DATABASE_URL by default for `sqlx database create` and `sqlx migrate run`
# - the application should use APP_DATABASE_URL at runtime
# - TABLE_CREATOR_DATABASE_URL is optional (only if you provision tables at runtime)
# -----------------------------------------------------------------------------
# script config
# -----------------------------------------------------------------------------
# DEBUG= # Enable verbose logging in scripts
# CONTAINER= # Sentinel used by scripts to skip docker bootstrap
#TTY_OVERRIDE=1
# ENV_PATH= # Override path to .env file
# -----------------------------------------------------------------------------
# Migrations path
# -----------------------------------------------------------------------------
ADMIN_MIGRATIONS_PATH=admin_migrations
APP_MIGRATIONS_PATH=migrations
RUN_APP_MIGRATIONS=1
# -----------------------------------------------------------------------------
# Database identity / networking
# -----------------------------------------------------------------------------
DB_HOST=127.0.0.1
DB_PORT=2345
APP_DB_NAME=mae_test
# -----------------------------------------------------------------------------
# Postgres bootstrap superuser
# (used only by sqlx_premigration.sh / init scripts)
# -----------------------------------------------------------------------------
SUPERUSER=postgres
SUPERUSER_PWD=password
# -----------------------------------------------------------------------------
# LOGIN roles created by premigration script
# -----------------------------------------------------------------------------
# Used by SQLx migrations
MIGRATOR_USER=db_migrator
MIGRATOR_PWD=migrator_secret
# Used by the application at runtime (inherits app_user)
APP_USER=app
APP_USER_PWD=secret
# Optional: only if you create tables at runtime (inherits table_creator)
TABLE_PROVISIONER_USER=table_provisioner
TABLE_PROVISIONER_PWD=provisioner_secret
# -----------------------------------------------------------------------------
# Connection strings
# -----------------------------------------------------------------------------
# Superuser (admin migrations)
SUPER_DATABASE_URL=postgres://${SUPERUSER}:${SUPERUSER_PWD}@${DB_HOST}:${DB_PORT}/${APP_DB_NAME}
SEARCH_PATH=options=-csearch_path%3Dapp
# Used by `sqlx database create` and `sqlx migrate run`
DATABASE_URL=postgres://${MIGRATOR_USER}:${MIGRATOR_PWD}@${DB_HOST}:${DB_PORT}/${APP_DB_NAME}?${SEARCH_PATH}
# Used by the application at runtime
APP_DATABASE_URL=postgres://${APP_USER}:${APP_USER_PWD}@${DB_HOST}:${DB_PORT}/${APP_DB_NAME}?${SEARCH_PATH}
# Optional: provisioning connection (restricted; do not use for normal app queries)
TABLE_CREATOR_DATABASE_URL=postgres://${TABLE_PROVISIONER_USER}:${TABLE_PROVISIONER_PWD}@${DB_HOST}:${DB_PORT}/${APP_DB_NAME}?${SEARCH_PATH}
# Explicit migrator URL (used by scripts)
MIGRATOR_DATABASE_URL=postgres://${MIGRATOR_USER}:${MIGRATOR_PWD}@${DB_HOST}:${DB_PORT}/${APP_DB_NAME}?${SEARCH_PATH}