mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Also where possible use the `config.seeds.defaultHttpdPort` instead of hardcoding it. Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
43 lines
872 B
TypeScript
43 lines
872 B
TypeScript
import type { BaseUrl } from "@httpd-client";
|
|
|
|
import configJson from "@app/config.json";
|
|
|
|
export interface Config {
|
|
reactions: string[];
|
|
seeds: {
|
|
defaultHttpdPort: number;
|
|
defaultNodePort: number;
|
|
defaultHttpdScheme: string;
|
|
pinned: { baseUrl: BaseUrl }[];
|
|
};
|
|
projects: {
|
|
pinned: {
|
|
name: string;
|
|
id: string;
|
|
baseUrl: BaseUrl;
|
|
}[];
|
|
};
|
|
}
|
|
|
|
function getConfig(): Config {
|
|
if (window.VITEST) {
|
|
return {
|
|
reactions: [],
|
|
seeds: {
|
|
defaultHttpdPort: 8081,
|
|
defaultHttpdScheme: "http",
|
|
defaultNodePort: 8776,
|
|
pinned: [],
|
|
},
|
|
projects: { pinned: [] },
|
|
};
|
|
} else if (window.PLAYWRIGHT) {
|
|
return window.APP_CONFIG;
|
|
} else {
|
|
// In dev and production environments we use data from config.json.
|
|
return configJson;
|
|
}
|
|
}
|
|
|
|
export const config = getConfig();
|