# ==============================================================================
# Changemaker Lite v2 — Environment Variables
# Generated by Ansible (Bunker Ops) — DO NOT EDIT MANUALLY
# Instance: {{ cml_domain }}
# Generated: {{ ansible_date_time.iso8601 }}
# ==============================================================================

# --- General ---
NODE_ENV={{ cml_node_env }}
DOMAIN={{ cml_domain }}
USER_ID={{ cml_user_id }}
GROUP_ID={{ cml_group_id }}
DOCKER_GROUP_ID={{ cml_docker_group_id }}

# --- V2 PostgreSQL ---
V2_POSTGRES_USER={{ cml_v2_postgres_user }}
V2_POSTGRES_PASSWORD={{ vault_cml_v2_postgres_password }}
V2_POSTGRES_DB={{ cml_v2_postgres_db }}
V2_POSTGRES_PORT={{ cml_postgres_port }}
DATABASE_URL=postgresql://{{ cml_v2_postgres_user }}:{{ vault_cml_v2_postgres_password }}@localhost:{{ cml_postgres_port }}/{{ cml_v2_postgres_db }}

# --- Redis ---
REDIS_PASSWORD={{ vault_cml_redis_password }}
REDIS_URL=redis://:{{ vault_cml_redis_password }}@redis-changemaker:6379

# --- JWT Auth ---
JWT_ACCESS_SECRET={{ vault_cml_jwt_access_secret }}
JWT_REFRESH_SECRET={{ vault_cml_jwt_refresh_secret }}
JWT_ACCESS_EXPIRY={{ cml_jwt_access_expiry }}
JWT_REFRESH_EXPIRY={{ cml_jwt_refresh_expiry }}

# --- Encryption ---
ENCRYPTION_KEY={{ vault_cml_encryption_key }}

# --- Initial Super Admin ---
INITIAL_ADMIN_EMAIL={{ vault_cml_initial_admin_email | default('admin@' + cml_domain) }}
INITIAL_ADMIN_PASSWORD={{ vault_cml_initial_admin_password }}

# --- API ---
API_PORT={{ cml_api_port }}
API_URL=http://localhost:{{ cml_api_port }}
CORS_ORIGINS=http://app.{{ cml_domain }},https://app.{{ cml_domain }},http://{{ cml_domain }},https://{{ cml_domain }},http://localhost:3000,http://localhost,http://localhost:4003

# --- Admin ---
ADMIN_URL=http://localhost:{{ cml_admin_port }}

# --- SMTP ---
SMTP_HOST={{ cml_smtp_host }}
SMTP_PORT={{ cml_smtp_port }}
SMTP_USER={{ cml_smtp_user }}
SMTP_PASS={{ vault_cml_smtp_pass | default('') }}
SMTP_FROM=noreply@{{ cml_domain }}
SMTP_FROM_NAME=Changemaker Lite
EMAIL_TEST_MODE={{ cml_email_test_mode }}
TEST_EMAIL_RECIPIENT={{ vault_cml_initial_admin_email | default('admin@' + cml_domain) }}

# --- Listmonk ---
LISTMONK_URL=http://listmonk-app:9000
LISTMONK_ADMIN_USER={{ cml_listmonk_admin_user }}
LISTMONK_ADMIN_PASSWORD={{ vault_cml_listmonk_api_token }}
LISTMONK_SYNC_ENABLED={{ cml_listmonk_sync_enabled }}
LISTMONK_WEBHOOK_SECRET={{ vault_cml_listmonk_api_token }}
LISTMONK_DB_HOST=listmonk-db
LISTMONK_DB_PORT=5432
LISTMONK_DB_USER=listmonk
LISTMONK_DB_PASSWORD={{ vault_cml_listmonk_db_password }}
LISTMONK_DB_NAME=listmonk
LISTMONK_WEB_ADMIN_USER=admin
LISTMONK_WEB_ADMIN_PASSWORD={{ vault_cml_listmonk_web_admin_password }}
LISTMONK_API_USER=api
LISTMONK_API_TOKEN={{ vault_cml_listmonk_api_token }}
LISTMONK_SMTP_HOST={{ cml_smtp_host }}
LISTMONK_SMTP_PORT={{ cml_smtp_port }}
LISTMONK_SMTP_USER={{ cml_smtp_user }}
LISTMONK_SMTP_PASSWORD={{ vault_cml_smtp_pass | default('') }}
LISTMONK_SMTP_TLS_TYPE={{ cml_listmonk_smtp_tls_type }}
LISTMONK_SMTP_FROM=Changemaker Lite <noreply@{{ cml_domain }}>

# --- Represent API ---
REPRESENT_API_URL=https://represent.opennorth.ca

# --- Geocoding ---
{% if cml_mapbox_api_key %}
MAPBOX_API_KEY={{ cml_mapbox_api_key }}
{% endif %}
GEOCODING_RATE_LIMIT_MS=1100
GEOCODING_CACHE_ENABLED=true
GEOCODING_CACHE_TTL_HOURS=24
{% if cml_google_maps_api_key %}
GOOGLE_MAPS_API_KEY={{ cml_google_maps_api_key }}
{% endif %}
GOOGLE_MAPS_ENABLED={{ cml_google_maps_enabled }}
GEOCODING_PARALLEL_ENABLED=true
GEOCODING_BATCH_SIZE=10
BULK_GEOCODE_ENABLED=true
BULK_GEOCODE_MAX_BATCH=5000

# --- Platform Services ---
NOCODB_URL=http://changemaker-v2-nocodb:8080
NOCODB_PORT={{ cml_nocodb_port }}
NC_ADMIN_EMAIL={{ vault_cml_initial_admin_email | default('admin@' + cml_domain) }}
NC_ADMIN_PASSWORD={{ vault_cml_nocodb_admin_password }}

N8N_URL=http://n8n-changemaker:5678
N8N_PORT={{ cml_n8n_port }}
N8N_HOST=n8n.{{ cml_domain }}
N8N_ENCRYPTION_KEY={{ vault_cml_n8n_encryption_key }}
N8N_USER_EMAIL={{ vault_cml_initial_admin_email | default('admin@' + cml_domain) }}
N8N_USER_PASSWORD={{ vault_cml_n8n_user_password }}

GITEA_URL=http://gitea-changemaker:3000
GITEA_PORT={{ cml_gitea_port }}
GITEA_ROOT_URL=https://git.{{ cml_domain }}
GITEA_DOMAIN=git.{{ cml_domain }}
GITEA_DB_PASSWD={{ vault_cml_gitea_db_passwd }}
GITEA_DB_ROOT_PASSWORD={{ vault_cml_gitea_db_root_password }}

# --- MailHog ---
MAILHOG_URL=http://mailhog-changemaker:8025

# --- Mini QR ---
MINI_QR_URL=http://mini-qr:8080
MINI_QR_PORT=8089

# --- Excalidraw ---
EXCALIDRAW_URL=http://excalidraw-changemaker:80
EXCALIDRAW_PORT=8090
EXCALIDRAW_WS_URL=wss://draw.{{ cml_domain }}

# --- Homepage ---
HOMEPAGE_URL=http://homepage-changemaker:3000
HOMEPAGE_VAR_BASE_URL=https://{{ cml_domain }}

# --- Vaultwarden ---
VAULTWARDEN_URL=http://vaultwarden-changemaker:80
VAULTWARDEN_DOMAIN=https://vault.{{ cml_domain }}
VAULTWARDEN_ADMIN_TOKEN={{ vault_cml_vaultwarden_admin_token }}

# --- Rocket.Chat ---
ROCKETCHAT_URL=http://rocketchat-changemaker:3000
ROCKETCHAT_ADMIN_USER=admin
ROCKETCHAT_ADMIN_PASSWORD={{ vault_cml_rocketchat_admin_password }}
ENABLE_CHAT={{ cml_enable_chat }}

# --- Gancio ---
GANCIO_PORT={{ cml_gancio_port }}
GANCIO_URL=http://gancio-changemaker:13120
GANCIO_BASE_URL=https://events.{{ cml_domain }}
GANCIO_ADMIN_USER={{ cml_gancio_admin_user }}
GANCIO_ADMIN_PASSWORD={{ vault_cml_gancio_admin_password }}
GANCIO_SYNC_ENABLED={{ cml_gancio_sync_enabled }}

# --- Pangolin ---
PANGOLIN_API_URL={{ cml_pangolin_api_url }}
PANGOLIN_API_KEY={{ vault_cml_pangolin_api_key | default('') }}
PANGOLIN_ORG_ID={{ cml_pangolin_org_id }}
PANGOLIN_SITE_ID={{ vault_cml_pangolin_site_id | default('') }}
PANGOLIN_ENDPOINT={{ vault_cml_pangolin_endpoint | default('') }}
PANGOLIN_NEWT_ID={{ vault_cml_pangolin_newt_id | default('') }}
PANGOLIN_NEWT_SECRET={{ vault_cml_pangolin_newt_secret | default('') }}

# --- NAR ---
NAR_DATA_DIR=/data

# --- Payments ---
ENABLE_PAYMENTS={{ cml_enable_payments }}

# --- Media ---
ENABLE_MEDIA_FEATURES={{ cml_enable_media }}
MEDIA_API_PORT={{ cml_media_api_port }}
MEDIA_API_PUBLIC_URL=http://media-api:{{ cml_media_api_port }}

# --- Docs / Code Server ---
CODE_SERVER_URL=http://code-server-changemaker:8443
CODE_SERVER_PORT=8888
MKDOCS_PREVIEW_URL=http://mkdocs-changemaker:8000
MKDOCS_PORT=4003

# --- Monitoring ---
PROMETHEUS_PORT=9090
GRAFANA_PORT=3005
GRAFANA_ADMIN_PASSWORD={{ vault_cml_grafana_admin_password }}
GRAFANA_ROOT_URL=http://localhost:3005
CADVISOR_PORT=8086
NODE_EXPORTER_PORT=9100
REDIS_EXPORTER_PORT=9121
ALERTMANAGER_PORT=9093
GOTIFY_PORT=8889
GOTIFY_ADMIN_USER=admin
GOTIFY_ADMIN_PASSWORD={{ vault_cml_gotify_admin_password }}

# --- Bunker Ops (Fleet Management) ---
INSTANCE_LABEL={{ bunker_ops_instance_label | default(cml_domain) }}
BUNKER_OPS_ENABLED={{ bunker_ops_enabled | string | lower }}
BUNKER_OPS_REMOTE_WRITE_URL={{ bunker_ops_remote_write_url }}
