mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-17 18:02:32 +00:00
add control plane service
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
679fd504a2
commit
57f221fb72
8 changed files with 766 additions and 0 deletions
25
exapps/control-plane/src/config.ts
Normal file
25
exapps/control-plane/src/config.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
export interface ControlPlaneConfig {
|
||||
port: number;
|
||||
version: string;
|
||||
nextcloudBaseUrl: string;
|
||||
}
|
||||
|
||||
export function loadConfig(env: NodeJS.ProcessEnv = process.env): ControlPlaneConfig {
|
||||
const portValue = env.PORT ?? "3000";
|
||||
const port = Number.parseInt(portValue, 10);
|
||||
|
||||
if (Number.isNaN(port)) {
|
||||
throw new Error(`Invalid PORT value: ${portValue}`);
|
||||
}
|
||||
|
||||
return {
|
||||
port,
|
||||
version: env.AINAS_VERSION ?? "0.1.0-dev",
|
||||
nextcloudBaseUrl: normalizeBaseUrl(env.NEXTCLOUD_BASE_URL ?? "http://nextcloud")
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeBaseUrl(url: string): string {
|
||||
return url.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue