mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 10:49:20 +00:00
29 lines
800 B
TypeScript
29 lines
800 B
TypeScript
import fs from "fs";
|
|
import path from "path";
|
|
|
|
import Logger from "../libs/Logger";
|
|
|
|
class Configuration {
|
|
|
|
public init(): void {
|
|
const dir = path.join(process.cwd(), 'configs/');
|
|
if (!fs.existsSync(dir)) {
|
|
fs.mkdirSync(dir);
|
|
}
|
|
this.copyExampleIfNotExists("Ping.json");
|
|
this.copyExampleIfNotExists("ServiceAnnouncement.json");
|
|
}
|
|
|
|
private copyExampleIfNotExists(file: string): void {
|
|
const dir = path.join(process.cwd(), 'configs/');
|
|
if (!fs.existsSync(path.join(dir, file))) {
|
|
fs.copyFileSync(path.join(process.cwd(), 'configs/', `${file.replace('.json', '.example.json')}`), path.join(dir, file));
|
|
}
|
|
}
|
|
|
|
// TODO: Make a real providers like Environment
|
|
|
|
}
|
|
|
|
export default new Configuration();
|