mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
27 lines
426 B
TypeScript
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;
|
|
};
|