mirror of
https://github.com/syuilo/ai.git
synced 2024-11-12 17:08:00 +00:00
config.tsのエラーに対処
This commit is contained in:
parent
830c9c2ecd
commit
f893fd3a3f
|
@ -17,9 +17,16 @@ type Config = {
|
||||||
memoryDir?: string;
|
memoryDir?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
import config from '../config.json' assert { type: 'json' };
|
import uncheckedConfig from '../config.json' assert { type: 'json' };
|
||||||
|
|
||||||
|
function validate(config: unknown): Config {
|
||||||
|
// TODO: as を使わずにしっかりと検証を行う
|
||||||
|
return config as Config;
|
||||||
|
}
|
||||||
|
|
||||||
|
const config = validate(uncheckedConfig);
|
||||||
|
|
||||||
config.wsUrl = config.host.replace('http', 'ws');
|
config.wsUrl = config.host.replace('http', 'ws');
|
||||||
config.apiUrl = config.host + '/api';
|
config.apiUrl = config.host + '/api';
|
||||||
|
|
||||||
export default config as Config;
|
export default config;
|
||||||
|
|
Loading…
Reference in a new issue