mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
add server init method to config
This commit is contained in:
@@ -9,6 +9,7 @@ import { createIntegrationApiServer } from "./integrationApiServer";
|
||||
import config from "@server/lib/config";
|
||||
|
||||
async function startServers() {
|
||||
await config.initServer();
|
||||
await runSetupFunctions();
|
||||
|
||||
// Start all servers
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user