mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-21 11:05:56 +00:00
Remove unused config
This commit is contained in:
parent
69896a7299
commit
0943e5d354
1 changed files with 13 additions and 5 deletions
|
@ -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…
Add table
Reference in a new issue