feat: add health check API and handle app configuration warnings

- Removed the old index.html file from the frontend build.
- Integrated a health check query in App component to verify app configuration.
- Display a warning alert if the app is not configured with AZURE_SUBSCRIPTION_ID.
- Updated API module to include health check endpoint.
This commit is contained in:
2026-04-19 21:16:15 +02:00
parent 599ac49a76
commit 28d0720ffa
12 changed files with 66 additions and 490 deletions

View File

@@ -36,6 +36,7 @@ const App = () => {
const [skuExport, setSkuExport] = useState("");
const [renderError, setRenderError] = useState("");
const healthQuery = useQuery({ queryKey: ["health"], queryFn: api.health });
const locationsQuery = useQuery({ queryKey: ["locations"], queryFn: api.locations });
const publishersQuery = useQuery({
queryKey: ["publishers", selection.location],
@@ -127,6 +128,8 @@ const App = () => {
};
const loading = locationsQuery.isLoading || templatesQuery.isLoading;
const healthError = healthQuery.error instanceof Error ? healthQuery.error.message : "";
const appNotConfigured = healthError.includes("Missing AZURE_SUBSCRIPTION_ID");
const locationsError = locationsQuery.error instanceof Error ? locationsQuery.error.message : "Failed to load locations";
return (
@@ -140,10 +143,16 @@ const App = () => {
Select a marketplace image and generate reusable snippets.
</Typography>
{appNotConfigured ? (
<Alert severity="warning">
App is not configured. Set AZURE_SUBSCRIPTION_ID (and Azure credentials) in the container start environment, then restart the app.
</Alert>
) : null}
{loading ? (
<CircularProgress />
) : locationsQuery.isError ? (
<Alert severity="error">{locationsError}</Alert>
<Alert severity={appNotConfigured ? "warning" : "error"}>{locationsError}</Alert>
) : (
<Card>
<CardContent>

View File

@@ -18,6 +18,7 @@ const json = async <T>(path: string): Promise<T> => {
};
export const api = {
health: () => json<{ status: string; message?: string }>("/api/health"),
locations: () => json<LocationOption[]>("/api/locations"),
publishers: (location: string) => json<string[]>(`/api/publishers?location=${encodeURIComponent(location)}`),
offers: (location: string, publisher: string) =>