From 93e243016b35117ff3e00f713f8e56a78a618ad6 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 26 Aug 2026 18:11:11 -0500 Subject: [PATCH] update new urls for V2 --- README.md | 41 ++++------------ config.env.example | 3 -- defaults.inc | 2 +- inc/runtime-config.inc | 92 +++--------------------------------- proxmenu-scripts.sh | 4 +- tests/test-runtime-config.sh | 52 ++++++++------------ 6 files changed, 40 insertions(+), 154 deletions(-) delete mode 100644 config.env.example diff --git a/README.md b/README.md index 46358d7..1e5b03c 100644 --- a/README.md +++ b/README.md @@ -138,41 +138,20 @@ maintenance evacuation routing, HA affinity parsing, host-profile migration signatures and backups, and VirtIO filename validation. Tests use temporary files and mocked Proxmox output; they do not download installers or change a Proxmox host. -## Deployment broker URL +## Deployment service endpoints -TA-ProxMenu exchanges deployment codes with the configured TAPM broker. The -URL is selected in this order: +TA-ProxMenu uses the built-in production endpoints: -1. Existing `TAPM_BROKER_URL` environment variable -2. `TAPM_BROKER_URL` in `/etc/ta-proxmenu/config.env` - -For a persistent per-system setting: - -```sh -install -d -m 0755 /etc/ta-proxmenu -install -m 0644 config.env.example /etc/ta-proxmenu/config.env +```text +Broker: https://tapm.technologyarch.com +Git: https://tagit.technologyarch.com ``` -The tracked example contains only: - -```dotenv -TAPM_BROKER_URL=https://tapm.example.com -GITEA_DOMAIN=git.example.com -``` - -Replace it with the deployed HTTPS origin, without an API path. There is no -hard-coded operational broker URL; authorization fails with a configuration -message when the variable is missing or invalid. `GITEA_DOMAIN` is a hostname, -without `https://` or a path. Repository updates use the installed -TA-ProxMenu checkout's configured Git `origin` and do not overwrite the system -configuration file. - -On the first V2 launch after installation or upgrade, TA-ProxMenu detects a -missing or incomplete `/etc/ta-proxmenu/config.env` and interactively requests -both values. Inputs are validated and written atomically with mode `0600` -before update checks or menu actions continue. A non-interactive launch without -valid configuration stops with an explicit setup message instead of selecting -a default company URL. +No first-run prompt or `/etc/ta-proxmenu/config.env` file is required. For a +controlled development or test environment only, `TAPM_BROKER_URL` and +`GITEA_DOMAIN` environment variables can override the built-in values for that +process. Repository updates continue to use the installed checkout's configured +Git `origin`. ## Installation registry diff --git a/config.env.example b/config.env.example deleted file mode 100644 index 1248320..0000000 --- a/config.env.example +++ /dev/null @@ -1,3 +0,0 @@ -# Copy to /etc/ta-proxmenu/config.env and replace with the deployed broker. -TAPM_BROKER_URL=https://tapm.example.com -GITEA_DOMAIN=git.example.com diff --git a/defaults.inc b/defaults.inc index fe593dd..c3bcd9d 100755 --- a/defaults.inc +++ b/defaults.inc @@ -3,7 +3,7 @@ action="${1:-}" FOLDER='/opt/idssys/ta-proxmenu' -VERS='2026.7.29-1' +VERS='2026.8.26-1' noupdate=' ' diff --git a/inc/runtime-config.inc b/inc/runtime-config.inc index b6bc307..a238dd6 100644 --- a/inc/runtime-config.inc +++ b/inc/runtime-config.inc @@ -1,24 +1,7 @@ #!/usr/bin/env bash -TAPM_CONFIG_FILE="${TAPM_CONFIG_FILE:-/etc/ta-proxmenu/config.env}" - -TAPM_CONFIG_READ_VALUE() { - local key="$1" - local value='' - - if [[ -r "$TAPM_CONFIG_FILE" ]]; then - value="$( - sed -n "s/^[[:space:]]*${key}[[:space:]]*=[[:space:]]*//p" \ - "$TAPM_CONFIG_FILE" | - tail -n 1 - )" - value="${value#\"}" - value="${value%\"}" - value="${value#\'}" - value="${value%\'}" - fi - printf '%s' "$value" -} +TAPM_DEFAULT_BROKER_URL='https://tapm.technologyarch.com' +TAPM_DEFAULT_GITEA_DOMAIN='tagit.technologyarch.com' TAPM_VALID_BROKER_ORIGIN() { [[ "${1:-}" =~ ^https://[A-Za-z0-9.-]+(:[0-9]+)?/?$ ]] @@ -29,16 +12,9 @@ TAPM_VALID_GITEA_DOMAIN() { } TAPM_LOAD_RUNTIME_CONFIG() { - if [[ -z "${TAPM_BROKER_URL:-}" ]]; then - TAPM_BROKER_URL="$(TAPM_CONFIG_READ_VALUE TAPM_BROKER_URL)" - fi - if [[ -z "${GITEA_DOMAIN:-}" ]]; then - GITEA_DOMAIN="$(TAPM_CONFIG_READ_VALUE GITEA_DOMAIN)" - fi - - TAPM_BROKER_URL="${TAPM_BROKER_URL:-}" + TAPM_BROKER_URL="${TAPM_BROKER_URL:-$TAPM_DEFAULT_BROKER_URL}" TAPM_BROKER_URL="${TAPM_BROKER_URL%/}" - GITEA_DOMAIN="${GITEA_DOMAIN:-}" + GITEA_DOMAIN="${GITEA_DOMAIN:-$TAPM_DEFAULT_GITEA_DOMAIN}" if TAPM_VALID_GITEA_DOMAIN "$GITEA_DOMAIN"; then GITEA_URL="https://${GITEA_DOMAIN}" else @@ -47,65 +23,11 @@ TAPM_LOAD_RUNTIME_CONFIG() { } TAPM_ENSURE_RUNTIME_CONFIG() { - local broker_url - local config_dir - local gitea_domain - local input_device='/dev/tty' - local temporary_file - TAPM_LOAD_RUNTIME_CONFIG - if [[ -r "$TAPM_CONFIG_FILE" ]] && - TAPM_VALID_BROKER_ORIGIN "$TAPM_BROKER_URL" && + if TAPM_VALID_BROKER_ORIGIN "$TAPM_BROKER_URL" && TAPM_VALID_GITEA_DOMAIN "$GITEA_DOMAIN"; then return 0 fi - - if [[ "${TAPM_CONFIG_TEST_STDIN:-0}" == 1 ]]; then - input_device='/dev/stdin' - exec 3>&2 - elif [[ ! -r /dev/tty || ! -w /dev/tty ]]; then - printf 'TA-ProxMenu requires %s with TAPM_BROKER_URL and GITEA_DOMAIN.\n' \ - "$TAPM_CONFIG_FILE" >&2 - return 1 - else - exec 3>/dev/tty - fi - - printf '\nTA-ProxMenu V2 requires deployment service configuration.\n' \ - >&3 - while true; do - printf 'TAPM broker HTTPS origin (example: https://tapm.example.com): ' \ - >&3 - IFS= read -r broker_url <"$input_device" || return 1 - broker_url="${broker_url%/}" - TAPM_VALID_BROKER_ORIGIN "$broker_url" && break - printf 'Enter an HTTPS origin without a path.\n' >&3 - done - while true; do - printf 'Git hostname (example: git.example.com): ' >&3 - IFS= read -r gitea_domain <"$input_device" || return 1 - TAPM_VALID_GITEA_DOMAIN "$gitea_domain" && break - printf 'Enter a hostname without https:// or a path.\n' >&3 - done - - config_dir="${TAPM_CONFIG_FILE%/*}" - [[ "$config_dir" != "$TAPM_CONFIG_FILE" ]] || config_dir='.' - mkdir -p "$config_dir" || return 1 - temporary_file="$(mktemp "${TAPM_CONFIG_FILE}.tmp.XXXXXX")" || return 1 - if ! { - printf 'TAPM_BROKER_URL=%s\n' "$broker_url" - printf 'GITEA_DOMAIN=%s\n' "$gitea_domain" - } >"$temporary_file" || - ! chmod 0600 "$temporary_file" || - ! mv -f "$temporary_file" "$TAPM_CONFIG_FILE"; then - rm -f "$temporary_file" - return 1 - fi - - TAPM_BROKER_URL="$broker_url" - GITEA_DOMAIN="$gitea_domain" - GITEA_URL="https://${GITEA_DOMAIN}" - printf 'Saved TA-ProxMenu configuration to %s.\n\n' "$TAPM_CONFIG_FILE" \ - >&3 - exec 3>&- + printf 'TA-ProxMenu has invalid built-in or overridden service configuration.\n' >&2 + return 1 } diff --git a/proxmenu-scripts.sh b/proxmenu-scripts.sh index 8771d1d..31397b2 100755 --- a/proxmenu-scripts.sh +++ b/proxmenu-scripts.sh @@ -165,8 +165,8 @@ TAPM_AUTHORIZE() { TAPM_CLEAR_AUTHORIZATION if ! TAPM_VALID_HTTPS_URL "${TAPM_BROKER_URL:-}"; then - echo -e "${idsCL[LightRed]}TAPM_BROKER_URL is not configured with a valid HTTPS origin.${idsCL[Default]}" - echo -e "${idsCL[LightYellow]}Set it in /etc/ta-proxmenu/config.env before authorizing this installation.${idsCL[Default]}" + echo -e "${idsCL[LightRed]}TAPM_BROKER_URL is not a valid HTTPS origin.${idsCL[Default]}" + echo -e "${idsCL[LightYellow]}Remove or correct the TAPM_BROKER_URL environment override before authorizing this installation.${idsCL[Default]}" return 1 fi if ! command -v python3 >/dev/null 2>&1; then diff --git a/tests/test-runtime-config.sh b/tests/test-runtime-config.sh index 4a1f36c..3bdaad5 100644 --- a/tests/test-runtime-config.sh +++ b/tests/test-runtime-config.sh @@ -5,41 +5,29 @@ TEST_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" test_dir="$(mktemp -d)" trap 'rm -rf "$test_dir"' EXIT -TAPM_CONFIG_FILE="${test_dir}/etc/config.env" -TAPM_CONFIG_TEST_STDIN=1 source "${TEST_ROOT}/inc/runtime-config.inc" -if ! printf '%s\n%s\n' \ - 'https://tapm.example.com' \ - 'git.example.com' | - TAPM_ENSURE_RUNTIME_CONFIG >/dev/null; then - printf 'FAIL: configuration wizard failed\n' >&2 - exit 1 -fi - -expected=$'TAPM_BROKER_URL=https://tapm.example.com\nGITEA_DOMAIN=git.example.com' -actual="$(cat "$TAPM_CONFIG_FILE")" -if [[ "$actual" != "$expected" ]]; then - printf 'FAIL: unexpected configuration contents\n' >&2 - exit 1 -fi -if stat -c '%a' "$TAPM_CONFIG_FILE" >/dev/null 2>&1; then - config_mode="$(stat -c '%a' "$TAPM_CONFIG_FILE")" -else - config_mode="$(stat -f '%Lp' "$TAPM_CONFIG_FILE")" -fi -if [[ "$config_mode" != 600 ]]; then - printf 'FAIL: configuration mode is not 600\n' >&2 - exit 1 -fi - unset TAPM_BROKER_URL GITEA_DOMAIN GITEA_URL -TAPM_LOAD_RUNTIME_CONFIG -if [[ "$TAPM_BROKER_URL" != 'https://tapm.example.com' || - "$GITEA_DOMAIN" != 'git.example.com' || - "$GITEA_URL" != 'https://git.example.com' ]]; then - printf 'FAIL: saved configuration did not reload\n' >&2 +if ! TAPM_ENSURE_RUNTIME_CONFIG >/dev/null; then + printf 'FAIL: built-in configuration was rejected\n' >&2 exit 1 fi -printf 'PASS: runtime configuration wizard\n' +if [[ "$TAPM_BROKER_URL" != 'https://tapm.technologyarch.com' || + "$GITEA_DOMAIN" != 'tagit.technologyarch.com' || + "$GITEA_URL" != 'https://tagit.technologyarch.com' ]]; then + printf 'FAIL: built-in configuration did not load\n' >&2 + exit 1 +fi + +TAPM_BROKER_URL='https://tapm.test.example' +GITEA_DOMAIN='git.test.example' +TAPM_LOAD_RUNTIME_CONFIG +if [[ "$TAPM_BROKER_URL" != 'https://tapm.test.example' || + "$GITEA_DOMAIN" != 'git.test.example' || + "$GITEA_URL" != 'https://git.test.example' ]]; then + printf 'FAIL: environment overrides did not load\n' >&2 + exit 1 +fi + +printf 'PASS: built-in runtime configuration\n'