mae 0.2.3

Opinionated async Rust framework for building Mae-Technologies micro-services — app scaffolding, repo layer, middleware, and test utilities.
Documentation
# .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}