Files
radicle-explorer/src/lib/config.ts
T
Sebastian Martinez 14ba807e55 Set the httpd port for the test suite to be 8081.
Also where possible use the `config.seeds.defaultHttpdPort` instead of
hardcoding it.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-17 15:19:31 +02:00

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();