#!/bin/sh set -eu # The generic image contains an empty fallback; installed containers mount the generated # public projection over it. An optional path lets host projection tests use this same check. config_file=${1:-/usr/share/nginx/html/config.js} test -f "$config_file" && test -r "$config_file" config=$(tr -d '[:space:]' < "$config_file") case "$config" in 'window.__THOTHII_CONFIG__={};') test -z "${THT_FRONTEND_CONFIG_REVISION:-}" ;; *) # Installation Load validates BCP47 syntax. Here check only the public payload shape; # catalog availability and fallback belong to the frontend, not the generic image. locale='[A-Za-z][A-Za-z0-9]*(-[A-Za-z0-9]+)*' full="\"mode\":\"full\",\"defaultLocale\":\"$locale\"" embedded="\"mode\":\"embedded\",\"defaultLocale\":\"$locale\",\"adapter\":\"omics-portal\"" if ! printf '%s\n' "$config" | LC_ALL=C grep -Eq "^window\.__THOTHII_CONFIG__=\{\"backendBaseUrl\":\"/api\",\"shell\":\{($full|$embedded)\}\};$"; then echo "Invalid frontend public runtime configuration" >&2 exit 1 fi ;; esac printf '%s\n' "frontend runtime config smoke: ok"