Fix usage of default config

This commit is contained in:
ajnart
2023-01-08 15:48:39 +09:00
parent 564a56f337
commit ad96c1d71a
4 changed files with 11 additions and 86 deletions

View File

@@ -1,12 +1,12 @@
import Consola from 'consola';
import { BackendConfigType } from '../../types/config';
import { BackendConfigType, ConfigType } from '../../types/config';
import { backendMigrateConfig } from './backendMigrateConfig';
import { configExists } from './configExists';
import { getFallbackConfig } from './getFallbackConfig';
import { readConfig } from './readConfig';
export const getConfig = (name: string): BackendConfigType => {
if (!configExists(name)) return getFallbackConfig();
if (!configExists(name)) return getFallbackConfig() as unknown as ConfigType;
// Else if config exists but contains no "schema_version" property
// then it is an old config file and we should try to migrate it
// to the new format.