{# An application's environment, as one swappable section. Three states render through this fragment - the masked table (view), the same table with its values in clear (revealed), and the KEY=VALUE editor (edit) - so the application page and the htmx swaps can never disagree about what this section looks like. Revealing a value, whether through Reveal or by opening the editor, is audited on the server: this panel prints a credential to the browser only when the operator explicitly asked, and the ask is on the record. Saving rewrites the .env file the application will read on its next start. The process already running keeps whatever it started with, which is why a save leaves a "restart required" notice with the button that already restarts this application from the rest of the page. A refused save renders at 200 with the refusal inline: htmx does not swap an error status, so answering 422 would freeze the screen and report nothing. #} {% import "_macros.html" as m %}
{% if app_env_problem %} {{ m.problem(app_env_problem.fix, app_env_problem.output) }} {% endif %} {% if app_env_restart_required %}

{{ m.badge("busy", "restart required") }} Environment saved. Restart the application to apply the change. {{ m.action_button("Restart", restart_endpoint, none, "Restarted " ~ app_env_domain) }}

{% endif %} {% if app_env_mode == "edit" %}
Replaces the whole file. Remove a line to remove that variable.
{% elif app_env_variables %} {% for key, value in app_env_variables %} {% endfor %}
VariableValue
{{ key }} {%- if app_env_mode == "revealed" %}{{ value }} {%- else %}{{ m.secret(value) }}{% endif -%}
{% if app_env_mode == "revealed" %} {% else %} {% endif %} {% else %}

No environment variables are recorded for this application.

{% endif %}