Update packages and improve SSL generation
This commit is contained in:
3377
package-lock.json
generated
3377
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
import "dotenv/config";
|
|
||||||
import dotenv from "dotenv";
|
import dotenv from "dotenv";
|
||||||
import { promises as fs } from "fs";
|
import { promises as fs } from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
import { AutoSSLSetup } from "./utils/auto-ssl-setup.js";
|
import { AutoSSLSetup } from "./utils/auto-ssl-setup.js";
|
||||||
import { AuthManager } from "./utils/auth-manager.js";
|
import { AuthManager } from "./utils/auth-manager.js";
|
||||||
import { DataCrypto } from "./utils/data-crypto.js";
|
import { DataCrypto } from "./utils/data-crypto.js";
|
||||||
@@ -10,17 +10,27 @@ import { systemLogger, versionLogger } from "./utils/logger.js";
|
|||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
|
dotenv.config({ quiet: true });
|
||||||
|
|
||||||
const dataDir = process.env.DATA_DIR || "./db/data";
|
const dataDir = process.env.DATA_DIR || "./db/data";
|
||||||
const envPath = path.join(dataDir, ".env");
|
const envPath = path.join(dataDir, ".env");
|
||||||
try {
|
try {
|
||||||
await fs.access(envPath);
|
await fs.access(envPath);
|
||||||
const persistentConfig = dotenv.config({ path: envPath });
|
const persistentConfig = dotenv.config({ path: envPath, quiet: true });
|
||||||
if (persistentConfig.parsed) {
|
if (persistentConfig.parsed) {
|
||||||
Object.assign(process.env, persistentConfig.parsed);
|
Object.assign(process.env, persistentConfig.parsed);
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
const version = process.env.VERSION || "unknown";
|
let version = "unknown";
|
||||||
|
try {
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const packageJsonPath = path.join(path.dirname(__filename), "../../../package.json");
|
||||||
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
|
||||||
|
version = packageJson.version || "unknown";
|
||||||
|
} catch (error) {
|
||||||
|
version = process.env.VERSION || "unknown";
|
||||||
|
}
|
||||||
versionLogger.info(`Termix Backend starting - Version: ${version}`, {
|
versionLogger.info(`Termix Backend starting - Version: ${version}`, {
|
||||||
operation: "startup",
|
operation: "startup",
|
||||||
version: version,
|
version: version,
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ export class AutoSSLSetup {
|
|||||||
private static readonly ENV_FILE = path.join(AutoSSLSetup.DATA_DIR, ".env");
|
private static readonly ENV_FILE = path.join(AutoSSLSetup.DATA_DIR, ".env");
|
||||||
|
|
||||||
static async initialize(): Promise<void> {
|
static async initialize(): Promise<void> {
|
||||||
|
if (process.env.ENABLE_SSL !== "true") {
|
||||||
|
systemLogger.info("SSL not enabled - skipping certificate generation", {
|
||||||
|
operation: "ssl_disabled_default",
|
||||||
|
enable_ssl: process.env.ENABLE_SSL || "undefined",
|
||||||
|
note: "Set ENABLE_SSL=true to enable SSL certificate generation",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (await this.isSSLConfigured()) {
|
if (await this.isSSLConfigured()) {
|
||||||
await this.logCertificateInfo();
|
await this.logCertificateInfo();
|
||||||
@@ -75,10 +84,6 @@ export class AutoSSLSetup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static async generateSSLCertificates(): Promise<void> {
|
private static async generateSSLCertificates(): Promise<void> {
|
||||||
systemLogger.info("Generating SSL certificates for local development...", {
|
|
||||||
operation: "ssl_cert_generation",
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
execSync("openssl version", { stdio: "pipe" });
|
execSync("openssl version", { stdio: "pipe" });
|
||||||
|
|||||||
Reference in New Issue
Block a user