refactor(server): config system (#11081)

This commit is contained in:
forehalo
2025-03-27 12:32:28 +00:00
parent 7091111f85
commit 0ea38680fa
274 changed files with 7583 additions and 5841 deletions
@@ -0,0 +1,31 @@
import CONFIG from '../../config.json';
export type ConfigDescriptor = {
desc: string;
type: 'String' | 'Number' | 'Boolean' | 'Array' | 'Object';
env?: string;
link?: string;
};
export type AppConfig = typeof CONFIG;
export type AvailableConfig = {
[K in keyof AppConfig]: {
module: K;
fields: Array<keyof AppConfig[K]>;
};
}[keyof AppConfig];
const IGNORED_MODULES: (keyof AppConfig)[] = [
'db',
'redis',
'copilot', // not ready
];
if (!environment.isSelfHosted) {
IGNORED_MODULES.push('payment');
}
export { CONFIG as ALL_CONFIG };
export const ALL_CONFIGURABLE_MODULES = Object.keys(CONFIG).filter(
key => !IGNORED_MODULES.includes(key as keyof AppConfig)
) as (keyof AppConfig)[];