server/utils/config.ts
2023-09-12 14:29:13 -10:00

27 lines
426 B
TypeScript

import data from "../config/config.toml";
export interface ConfigType {
database: {
host: string;
port: number;
username: string;
password: string;
database: string;
};
http: {
port: number;
base_url: string;
};
[key: string]: unknown;
}
export const getConfig = () => {
return data as ConfigType;
};
export const getHost = () => {
const url = new URL(getConfig().http.base_url);
return url.host;
};