updated docker
Signed-off-by: OpenClaw Bot <ai-agent@topdoglabs.com>
This commit is contained in:
parent
6d4d37a5b4
commit
54038373fc
@ -158,6 +158,12 @@ GANTT_API_BEARER_TOKEN= # Optional server-to-server auth header
|
||||
GANTT_API_COOKIE= # Optional server-to-server cookie header
|
||||
```
|
||||
|
||||
`/tasks`, `/projects`, and `/mission` read data server-side from `gantt-board` via:
|
||||
1. `GANTT_API_BASE_URL`
|
||||
2. `NEXT_PUBLIC_GANTT_API_BASE_URL`
|
||||
3. `NEXT_PUBLIC_GANTT_BOARD_URL + /api` (fallback)
|
||||
4. default `http://localhost:3000/api` (local-only fallback)
|
||||
|
||||
Website URLs are centralized in `lib/config/sites.ts` and can be overridden via the optional variables above.
|
||||
|
||||
## Getting Started
|
||||
|
||||
@ -44,7 +44,7 @@ services:
|
||||
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-}
|
||||
SUPABASE_SERVICE_ROLE_KEY: ${SUPABASE_SERVICE_ROLE_KEY:-}
|
||||
SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL:-}
|
||||
SUPABASE_ANON_KEY: ${SUPABASENEXT_PUBLIC_SUPABASE_ANON_KEY_ANON_KEY:-}
|
||||
SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY:-}
|
||||
GANTT_API_BASE_URL: ${GANTT_API_BASE_URL:-}
|
||||
GANTT_API_REVALIDATE_SECONDS: ${GANTT_API_REVALIDATE_SECONDS:-}
|
||||
GANTT_API_BEARER_TOKEN: ${GANTT_API_BEARER_TOKEN:-}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
const DEFAULT_GANTT_API_BASE_URL = "http://localhost:3000/api";
|
||||
const DEFAULT_REVALIDATE_SECONDS = 15;
|
||||
let hasWarnedDefaultBaseUrl = false;
|
||||
|
||||
type CacheEntry = {
|
||||
expiresAt: number;
|
||||
@ -13,11 +14,41 @@ function normalizeBaseUrl(url: string): string {
|
||||
return url.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
function deriveApiBaseUrlFromGanttBoardUrl(): string | null {
|
||||
const ganttBoardUrl = process.env.NEXT_PUBLIC_GANTT_BOARD_URL;
|
||||
if (!ganttBoardUrl) return null;
|
||||
|
||||
try {
|
||||
const parsed = new URL(ganttBoardUrl);
|
||||
const pathname = parsed.pathname.replace(/\/+$/, "");
|
||||
parsed.pathname = `${pathname}/api`;
|
||||
parsed.search = "";
|
||||
parsed.hash = "";
|
||||
return normalizeBaseUrl(parsed.toString());
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function getGanttApiBaseUrl(): string {
|
||||
const derivedFromGanttBoardUrl = deriveApiBaseUrlFromGanttBoardUrl();
|
||||
const configured =
|
||||
process.env.GANTT_API_BASE_URL ||
|
||||
process.env.NEXT_PUBLIC_GANTT_API_BASE_URL ||
|
||||
derivedFromGanttBoardUrl ||
|
||||
DEFAULT_GANTT_API_BASE_URL;
|
||||
|
||||
if (
|
||||
configured === DEFAULT_GANTT_API_BASE_URL &&
|
||||
process.env.NODE_ENV === "production" &&
|
||||
!hasWarnedDefaultBaseUrl
|
||||
) {
|
||||
hasWarnedDefaultBaseUrl = true;
|
||||
console.warn(
|
||||
"[gantt-api] Using default base URL http://localhost:3000/api. Set GANTT_API_BASE_URL or NEXT_PUBLIC_GANTT_API_BASE_URL for deployed environments.",
|
||||
);
|
||||
}
|
||||
|
||||
return normalizeBaseUrl(configured);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user