# Secrets de l'application {{ app_python_application.nom }} — genere par Set-OPS (app_python), depuis la voute. {% for nom in app_python_contrat.secrets | default([]) %} {{ nom }}="{{ app_python_secrets[nom] | string | replace('\\', '\\\\') | replace('"', '\\"') }}" {% endfor %} {% if app_python_base | length > 0 %} {#- LA BASE (2026-11-15) : les variables de libpq, que psycopg et la plupart des pilotes lisent d'eux-memes, et `DATABASE_URL`, que SQLAlchemy, Django (dj-database-url) et d'autres lisent. Le mot de passe entre dans l'URL encode : un `@`, un `:` ou un `/` la casseraient. -#} {%- set mdp = app_python_base_mdp | string -%} {%- set mode = 'verify-full' if (app_python_base.tls | bool) else 'prefer' -%} {%- set url = 'postgresql://' ~ (app_python_base.utilisateur | urlencode | replace('/', '%2F')) ~ ':' ~ (mdp | urlencode | replace('/', '%2F')) ~ '@' ~ app_python_base.hote ~ ':' ~ app_python_base.port ~ '/' ~ app_python_base.base ~ '?sslmode=' ~ mode ~ (('&sslrootcert=' ~ app_python_base.ca) if (app_python_base.tls | bool) else '') %} PGHOST="{{ app_python_base.hote }}" PGPORT="{{ app_python_base.port }}" PGDATABASE="{{ app_python_base.base }}" PGUSER="{{ app_python_base.utilisateur }}" PGPASSWORD="{{ mdp | replace('\\', '\\\\') | replace('"', '\\"') }}" PGSSLMODE="{{ mode }}" {% if app_python_base.tls | bool %} PGSSLROOTCERT="{{ app_python_base.ca }}" {% endif %} DATABASE_URL="{{ url | replace('\\', '\\\\') | replace('"', '\\"') }}" {% endif %}