mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-28 14:44:55 +02:00
add server init method to config
This commit is contained in:
parent
66191a9610
commit
e694817b57
2 changed files with 10 additions and 8 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue