add server init method to config

This commit is contained in:
miloschwartz 2025-06-25 12:18:29 -04:00
parent 66191a9610
commit e694817b57
No known key found for this signature in database
2 changed files with 10 additions and 8 deletions

View file

@ -17,10 +17,6 @@ export class Config {
isDev: boolean = process.env.ENVIRONMENT !== "prod";
constructor() {
this.load();
}
public load() {
const environment = readConfigFile();
const {
@ -99,13 +95,18 @@ export class Config {
? "true"
: "false";
license.setServerSecret(parsedConfig.server.secret);
this.checkKeyStatus();
this.rawConfig = parsedConfig;
}
public async initServer() {
if (!this.rawConfig) {
throw new Error("Config not loaded. Call load() first.");
}
license.setServerSecret(this.rawConfig.server.secret);
await this.checkKeyStatus();
}
private async checkKeyStatus() {
const licenseStatus = await license.check();
if (!licenseStatus.isHostLicensed) {