2023-09-11 05:31:08 +02:00
|
|
|
import data from "../config/config.toml";
|
|
|
|
|
|
2023-09-11 05:46:20 +02:00
|
|
|
export interface ConfigType {
|
2023-09-11 05:31:08 +02:00
|
|
|
database: {
|
|
|
|
|
host: string;
|
|
|
|
|
port: number;
|
|
|
|
|
username: string;
|
|
|
|
|
password: string;
|
|
|
|
|
database: string;
|
|
|
|
|
}
|
2023-09-11 05:54:14 +02:00
|
|
|
http: {
|
|
|
|
|
port: number;
|
|
|
|
|
base_url: string;
|
|
|
|
|
}
|
2023-09-11 05:46:20 +02:00
|
|
|
[ key: string ]: unknown;
|
2023-09-11 05:31:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getConfig = () => {
|
|
|
|
|
return data as ConfigType;
|
2023-09-11 05:54:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getHost = () => {
|
|
|
|
|
const url = new URL(getConfig().http.base_url);
|
|
|
|
|
|
|
|
|
|
return url.host;
|
2023-09-11 05:31:08 +02:00
|
|
|
}
|