mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-09 20:26:40 +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";
|
import config from "@server/lib/config";
|
||||||
|
|
||||||
async function startServers() {
|
async function startServers() {
|
||||||
|
await config.initServer();
|
||||||
await runSetupFunctions();
|
await runSetupFunctions();
|
||||||
|
|
||||||
// Start all servers
|
// Start all servers
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ export class Config {
|
|||||||
isDev: boolean = process.env.ENVIRONMENT !== "prod";
|
isDev: boolean = process.env.ENVIRONMENT !== "prod";
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public load() {
|
|
||||||
const environment = readConfigFile();
|
const environment = readConfigFile();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -99,13 +95,18 @@ export class Config {
|
|||||||
? "true"
|
? "true"
|
||||||
: "false";
|
: "false";
|
||||||
|
|
||||||
license.setServerSecret(parsedConfig.server.secret);
|
|
||||||
|
|
||||||
this.checkKeyStatus();
|
|
||||||
|
|
||||||
this.rawConfig = parsedConfig;
|
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() {
|
private async checkKeyStatus() {
|
||||||
const licenseStatus = await license.check();
|
const licenseStatus = await license.check();
|
||||||
if (!licenseStatus.isHostLicensed) {
|
if (!licenseStatus.isHostLicensed) {
|
||||||
|
|||||||
Reference in New Issue
Block a user