feat: externalize config via env vars
CI / Build Native (push) Successful in 20m1s

- Add .env.example with all configurable variables documented
  (DB URL, HTTP port/host, cookie, JWT issuer/keys, log level)
- Remove hardcoded -Dquarkus.http.host from Dockerfile ENTRYPOINT
  (application.properties already sets the default; env vars
  can now override it at runtime without conflicting with -D flags)

All env vars follow Quarkus's auto-binding convention:
property.key → PROPERTY_KEY (uppercase)

Most useful for production:
- QUARKUS_DATASOURCE_JDBC_URL: DB file path
- QUARKUS_HTTP_PORT: HTTP port
- QUARKUS_HTTP_HOST: bind interface
- APP_AUTH_COOKIE_SECURE: enable Secure flag behind HTTPS
- MP_JWT_VERIFY_PUBLICKEY_LOCATION: externalize RSA keys
This commit is contained in:
2026-08-13 09:27:53 -04:00
parent ee1363535c
commit 9646236fa8
2 changed files with 50 additions and 1 deletions
+49
View File
@@ -0,0 +1,49 @@
# shot-crafter-calculator — variables de entorno
# Las variables siguen la convencion de Quarkus: puntos → underscores, mayusculas.
# Cualquier property de src/main/resources/application.properties se puede overridear.
#
# Uso:
# docker run --env-file .env gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
# docker run -e QUARKUS_HTTP_PORT=9090 gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
# ===== HTTP server =====
# QUARKUS_HTTP_PORT=8080
# QUARKUS_HTTP_HOST=0.0.0.0
# ===== Base de datos =====
# Default: jdbc:h2:file:./data/shots (queda en /work/data/shots.mv.db dentro del container)
# Produccion tipica (con volumen montado en /work/data):
# QUARKUS_DATASOURCE_JDBC_URL=jdbc:h2:file:/work/data/shots;DB_CLOSE_DELAY=-1
# Para MySQL/Postgres cambiar tambien db-kind y credenciales:
# QUARKUS_DATASOURCE_DB_KIND=mysql
# QUARKUS_DATASOURCE_JDBC_URL=jdbc:mysql://db:3306/shots
# QUARKUS_DATASOURCE_USERNAME=shot
# QUARKUS_DATASOURCE_PASSWORD=secret
# QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION=update
# ===== JWT / Auth =====
# MP_JWT_VERIFY_ISSUER=shot-crafter-calculator
# MP_JWT_VERIFY_PUBLICKEY_LOCATION=publicKey.pem
# SMALLRYE_JWT_SIGN_KEY_LOCATION=privateKey.pem
# Si queres que el container NO bakee las claves, monta los .pem como volumen:
# docker run -v ./keys:/work/keys \
# -e MP_JWT_VERIFY_PUBLICKEY_LOCATION=/work/keys/publicKey.pem \
# -e SMALLRYE_JWT_SIGN_KEY_LOCATION=/work/keys/privateKey.pem ...
# ===== Cookie =====
# APP_AUTH_COOKIE_NAME=auth-token
# APP_AUTH_COOKIE_MAX_AGE_SECONDS=86400
# APP_AUTH_COOKIE_SECURE=false # cambiar a true en produccion con HTTPS
# ===== Logging =====
# QUARKUS_LOG_LEVEL=INFO
# QUARKUS_LOG_CATEGORY__com_l2_shots=DEBUG
# ===== Ejemplo de uso con persistencia =====
# docker run -d \
# --name shot-crafter \
# -p 8080:8080 \
# -v /opt/shot-crafter-data:/work/data \
# -e QUARKUS_DATASOURCE_JDBC_URL='jdbc:h2:file:/work/data/shots;DB_CLOSE_DELAY=-1' \
# -e APP_AUTH_COOKIE_SECURE=true \
# gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest