mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
21 lines
587 B
TypeScript
21 lines
587 B
TypeScript
/**
|
|
* Config loader
|
|
* Pokemon Showdown - http://pokemonshowdown.com/
|
|
*
|
|
* @license MIT
|
|
*/
|
|
|
|
import * as defaults from '../config/config-example';
|
|
|
|
const CONFIG_PATH = require.resolve('../config/config');
|
|
|
|
export function load(invalidate = false) {
|
|
if (invalidate) delete require.cache[CONFIG_PATH];
|
|
const config: Config = Object.assign({}, defaults, require('../config/config'));
|
|
// config.routes is nested - we need to ensure values are set for its keys as well.
|
|
config.routes = Object.assign({}, defaults.routes, config.routes);
|
|
return config;
|
|
}
|
|
|
|
export const Config = load();
|