Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e22d560
Add SSL authentication method for database setup
nilanjan-debnath Jan 10, 2026
4c72bdc
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 10, 2026
398a36f
Update server/setup-database.js
nilanjan-debnath Jan 10, 2026
e7b908f
Update server/setup-database.js
nilanjan-debnath Jan 10, 2026
57f0528
Update server/database.js
nilanjan-debnath Jan 10, 2026
6c05956
chore: improved ui and accessing env variables using getEnvOrFile
nilanjan-debnath Jan 10, 2026
ac1bd9c
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 10, 2026
9cf16eb
add new translation keys for new labels and descriptions
nilanjan-debnath Jan 10, 2026
f0bbbd1
Merge branch 'master' of https://github.com/nilanjan-debnath/uptime-kuma
nilanjan-debnath Jan 10, 2026
5a6d3e5
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 10, 2026
914eebe
Update src/pages/SetupDatabase.vue
nilanjan-debnath Jan 11, 2026
437994c
Update src/lang/en.json
nilanjan-debnath Jan 11, 2026
4c68077
Update src/pages/SetupDatabase.vue
nilanjan-debnath Jan 11, 2026
945a2c9
Update src/pages/SetupDatabase.vue
nilanjan-debnath Jan 11, 2026
23bd28d
Merge branch 'master' into master
nilanjan-debnath Jan 11, 2026
f748e11
Apply suggestion from @CommanderStorm
CommanderStorm Jan 11, 2026
92207a5
style: reorder v-if before class in SetupDatabase.vue
nilanjan-debnath Jan 11, 2026
be1f4a6
Merge branch 'master' of https://github.com/nilanjan-debnath/uptime-kuma
nilanjan-debnath Jan 11, 2026
bdb9b79
fix fmt
CommanderStorm Jan 11, 2026
7e4d392
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions server/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ class Database {
port: dbConfig.port,
user: dbConfig.username,
password: dbConfig.password,
...(dbConfig.ssl
? {
ssl: {
rejectUnauthorized: true,
...(dbConfig.ca && dbConfig.ca.trim() !== "" ? { ca: [dbConfig.ca] } : {}),
},
}
: {}),
});

// Set to true, so for example "uptime.kuma", becomes `uptime.kuma`, not `uptime`.`kuma`
Expand All @@ -309,6 +317,14 @@ class Database {
}
return next();
},
...(dbConfig.ssl
? {
ssl: {
rejectUnauthorized: true,
...(dbConfig.ca && dbConfig.ca.trim() !== "" ? { ca: [dbConfig.ca] } : {}),
},
}
: {}),
},
pool: mariadbPoolConfig,
};
Expand Down
10 changes: 10 additions & 0 deletions server/setup-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class SetupDatabase {
dbConfig.dbName = process.env.UPTIME_KUMA_DB_NAME;
dbConfig.username = getEnvOrFile("UPTIME_KUMA_DB_USERNAME");
dbConfig.password = getEnvOrFile("UPTIME_KUMA_DB_PASSWORD");
dbConfig.ssl = getEnvOrFile("UPTIME_KUMA_DB_SSL")?.toLowerCase() === "true";
dbConfig.ca = getEnvOrFile("UPTIME_KUMA_DB_CA");
Database.writeDBConfig(dbConfig);
}
}
Expand Down Expand Up @@ -239,6 +241,14 @@ class SetupDatabase {
user: dbConfig.username,
password: dbConfig.password,
database: dbConfig.dbName,
...(dbConfig.ssl
? {
ssl: {
rejectUnauthorized: true,
...(dbConfig.ca && dbConfig.ca.trim() !== "" ? { ca: [dbConfig.ca] } : {}),
},
}
: {}),
});
await connection.execute("SELECT 1");
connection.end();
Expand Down
4 changes: 4 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"setupDatabaseSQLite": "A simple database file, recommended for small-scale deployments. Prior to v2.0.0, Uptime Kuma used SQLite as the default database.",
"settingUpDatabaseMSG": "Setting up the database. It may take a while, please be patient.",
"dbName": "Database Name",
"enableSSL": "Enable SSL/TLS",
"mariadbUseSSLHelptext": "Enable to use a encrypted connection to your database. Required for most cloud databases.",
"mariadbCaCertificateLabel": "CA Certificate",
"mariadbCaCertificateHelptext": "Paste the CA Cert in PEM format to use with self-signed certificates. Leave blank if your database uses a certificate signed by a public CA.",
"Settings": "Settings",
"Dashboard": "Dashboard",
"Help": "Help",
Expand Down
44 changes: 44 additions & 0 deletions src/pages/SetupDatabase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,40 @@
<input id="floatingInput" v-model="dbConfig.dbName" type="text" class="form-control" required />
<label for="floatingInput">{{ $t("dbName") }}</label>
</div>

<div class="mt-3 short text-start">
<div class="form-check form-switch ps-0" style="height: auto; display: block; padding: 0">
<div class="d-flex align-items-center">
<input
id="sslCheck"
v-model="dbConfig.ssl"
type="checkbox"
role="switch"
class="form-check-input ms-0 me-2"
style="float: none"
/>
<label class="form-check-label fw-bold" for="sslCheck">
{{ $t("enableSSL") }}
<span class="fw-normal text-muted" style="font-size: 0.9em">({{ $t("Optional") }})</span>
</label>
</div>
<div class="form-text mt-1">
{{ $t("mariadbUseSSLHelptext") }}
</div>
</div>
</div>

<div class="form-floating mt-3 short" v-if="dbConfig.ssl">

Check warning on line 147 in src/pages/SetupDatabase.vue

View workflow job for this annotation

GitHub Actions / check-linters

Attribute "v-if" should go before "class"
<textarea
id="caInput"
v-model="dbConfig.ca"
class="form-control"
placeholder="-----BEGIN CERTIFICATE-----"
style="height: 120px"
></textarea>
<label for="caInput">{{ $t("mariadbCaCertificateLabel") }}</label>
<div class="form-text">{{ $t("mariadbCaCertificateHelptext") }}</div>
</div>
</template>

<button class="btn btn-primary mt-4 short" type="submit" :disabled="disabledButton">
Expand Down Expand Up @@ -148,6 +182,8 @@
username: "",
password: "",
dbName: "kuma",
ssl: false,
ca: "",
},
info: {
needSetup: false,
Expand Down Expand Up @@ -253,6 +289,14 @@
}
}
.form-check {
height: calc(3.5rem + 2px);
padding: 0;
display: flex;
align-items: center;
justify-content: space-around;
}
.short {
width: 300px;
}
Expand Down
Loading