{# The Configuration page (spec §7.1, task 104). Two forms and a table, in that order: the things that can be changed while the gateway runs, then everything that cannot. The table is last because it is read once, when something is not behaving the way the file says it should. The username and password boxes sit in a reveal panel governed by the switch, so a gateway meant to stay open does not show two boxes nobody will fill in. With no script the panel is simply visible and the form submits the same fields — see static/js/forms.js. #} {% extends "base.html" %} {% from "partials/field.html" import choice, field, generate, secret, switch %} {% block title %}Configuration · mcp-api-gateway{% endblock %} {% block scripts %} {% endblock %} {% block content %}

Configuration

Admin login

{{ admin.lead }}

{{ switch(admin.enabled_field, "Require a login for the configuration and monitoring pages", checked=admin.enabled, reveal=admin.group) }}
{{ field(admin.username_field, "Username", value=admin.username, error=admin.errors.get(admin.username_field)) }} {{ secret(admin.password_field, "Password", hint=admin.password_hint, error=admin.errors.get(admin.password_field)) }}
{# The bearer token on /mcp (task 126). Second rather than last: this and the card above it are the gateway's two doors, and a page with one of them at the top and the other below the metrics export would make them look unrelated. Two nested reveal panels, as on the export card: the switch governs the whole thing, and "Replace the token" governs the box holding one — which is only offered when there is a token to replace. The Generate button is hidden until forms.js unhides it, because a button that fills a box needs a script to fill it with; without one the hint says how to make a token at a shell. #}

MCP endpoint

{{ mcp.lead }}

{{ switch(mcp.enabled_field, "Require a bearer token on " ~ mcp.path, checked=mcp.enabled, reveal=mcp.group) }}
{% if mcp.has_token %} {{ switch(mcp.replace_field, "Replace the token", reveal=mcp.token_group, hint=mcp.token_hint) }}
{{ field(mcp.token_field, "Bearer token", hint=mcp.replace_hint, error=mcp.errors.get(mcp.token_field)) }} {{ generate(mcp.token_field) }}
{% else %} {{ field(mcp.token_field, "Bearer token", hint=mcp.token_hint, error=mcp.errors.get(mcp.token_field)) }} {{ generate(mcp.token_field) }} {% endif %}

{{ mcp.guards }}

Automatic refresh

{{ field(auto_refresh.field, "Minutes between refreshes", value=auto_refresh.typed, type="number", placeholder=auto_refresh.configured, hint=auto_refresh.hint, error=auto_refresh.error) }}
{# The metrics export (task 125). Two nested reveal panels: the switch governs the whole thing, and inside it "Replace the licence key" governs the box holding one — which is only offered when there is a key to replace. With no script both panels are simply visible and the form submits the same fields. #}

Metrics export

{{ export.lead }}

{{ switch(export.enabled_field, "Send the usage counters to New Relic", checked=export.enabled, reveal=export.group) }}
{{ choice(export.region_field, "Region", export.regions, export.region, error=export.errors.get(export.region_field)) }} {{ field(export.service_field, "Service name", value=export.service_name, hint=export.service_hint, error=export.errors.get(export.service_field)) }} {% if export.has_key %} {{ switch(export.replace_field, "Replace the licence key", reveal=export.key_group, hint=export.key_hint) }}
{{ secret(export.key_field, "Licence key", error=export.errors.get(export.key_field)) }}
{% else %} {{ secret(export.key_field, "Licence key", hint=export.key_hint, error=export.errors.get(export.key_field)) }} {% endif %}

{{ export.what_is_sent }}

{% if export.status %}

{{ export.status }}

{% endif %}
{# Its own form, because it is its own decision: everywhere else on this page an empty box means "leave this alone", so taking a secret away has to be asked for rather than done by clearing a field. #} {% if export.has_key %}
{% endif %}

Everything else in force

{{ config_note }} These take a restart to change.

{% for fact in facts %} {% endfor %}
Setting Value Where it came from
{{ fact.key }} {{ fact.value }} {{ fact.source }}
{% endblock %}