Remove unused config

pull/5418/head
Gabriel Ngandu-Biseba 3 weeks ago
parent 69896a7299
commit 0943e5d354

@ -12,7 +12,6 @@ const { UptimeCalculator } = require("./uptime-calculator");
const dayjs = require("dayjs");
const { SimpleMigrationServer } = require("./utils/simple-migration-server");
const KumaColumnCompiler = require("./utils/knex/lib/dialects/mysql2/schema/mysql2-columncompiler");
const { mariaDbSslCert, mariaDbUseSSL } = require("./config");
/**
* Database & App Data Folder
@ -186,10 +185,18 @@ class Database {
/**
* @typedef {string|undefined} envString
* @param {{type: "sqlite"} | {type:envString, hostname:envString, port:envString, database:envString, username:envString, password:envString}} dbConfig the database configuration that should be written
* @param {{type: "sqlite"} | {type:envString, hostname:envString, port:envString, database:envString, username:envString, password:envString, caFilePath:envString}} dbConfig the database configuration that should be written
* @returns {void}
*/
static writeDBConfig(dbConfig) {
// Move CA file to the data directory
if (dbConfig.caFilePath) {
const dataCaFilePath = path.join(Database.dataDir, "mariadb-ca.pem");
fs.renameSync(dbConfig.caFilePath, dataCaFilePath);
dbConfig.caFilePath = dataCaFilePath;
dbConfig.ssl = undefined;
dbConfig.caFile = undefined;
}
fs.writeFileSync(path.join(Database.dataDir, "db-config.json"), JSON.stringify(dbConfig, null, 4));
}
@ -263,8 +270,8 @@ class Database {
let sslConfig = null;
let serverCa = undefined;
if (mariaDbUseSSL === true) {
serverCa = [ fs.readFileSync(mariaDbSslCert, "utf8") ];
if (dbConfig.caFilePath) {
serverCa = [ fs.readFileSync(dbConfig.caFilePath, "utf8") ];
sslConfig = {
rejectUnauthorized: true,
ca: serverCa
@ -290,8 +297,9 @@ class Database {
user: dbConfig.username,
password: dbConfig.password,
database: dbConfig.dbName,
timezone: "Z",
ssl: sslConfig,
timezone: "Z",
//ssl: sslConfig,
typeCast: function (field, next) {
if (field.type === "DATETIME") {
// Do not perform timezone conversion

Loading…
Cancel
Save