Add TLS feature with Caddy

This commit is contained in:
2026-10-21 09:13:59 +01:00
parent 1462067e72
commit ed4a6f3ec8
109 changed files with 6374 additions and 156 deletions
+145
View File
@@ -281,6 +281,151 @@ const schema: BUN_SQLITE_DatabaseSchemaType = {
},
],
},
{
tableName: "client_routes",
tableDescription: `TLS routes served to WireGuard clients`,
fields: [
{
fieldName: "user_id",
dataType: "INTEGER",
},
{
fieldName: "host_id",
dataType: "INTEGER",
defaultValue: 0,
},
{
fieldName: "name",
dataType: "TEXT",
},
{
fieldName: "hostname",
dataType: "TEXT",
},
{
fieldName: "path_prefix",
dataType: "TEXT",
defaultValue: "/",
},
{
fieldName: "strip_prefix",
dataType: "INTEGER",
options: [0, 1],
defaultValue: 0,
},
{
fieldName: "upstream_url",
dataType: "TEXT",
},
{
fieldName: "upstream_tls_verify",
dataType: "INTEGER",
options: [0, 1],
defaultValue: 1,
},
{
fieldName: "enabled",
dataType: "INTEGER",
options: [0, 1],
defaultValue: 1,
},
{
fieldName: "notes",
dataType: "TEXT",
},
{
fieldName: "acme_email",
dataType: "TEXT",
},
{
fieldName: "acme_dns_provider",
dataType: "TEXT",
},
{
fieldName: "acme_staging",
dataType: "INTEGER",
options: [0, 1],
defaultValue: 0,
},
{
fieldName: "acme_credentials",
dataType: "TEXT",
},
],
uniqueConstraints: [
{
constraintName: "Unique path per route hostname",
alias: "unique_path_per_route_hostname",
constraintTableFields: [
{ value: "hostname" },
{ value: "path_prefix" },
],
},
],
},
{
tableName: "tls_certificates",
tableDescription: `TLS certificates served by the Caddy ingress`,
fields: [
{
fieldName: "user_id",
dataType: "INTEGER",
},
{
fieldName: "hostname",
dataType: "TEXT",
unique: true,
},
{
fieldName: "provider",
dataType: "TEXT",
defaultValue: "letsencrypt",
},
{
fieldName: "challenge",
dataType: "TEXT",
defaultValue: "dns-01",
},
{
fieldName: "dns_provider",
dataType: "TEXT",
},
{
fieldName: "cert_path",
dataType: "TEXT",
},
{
fieldName: "key_path",
dataType: "TEXT",
},
{
fieldName: "expires_at",
dataType: "INTEGER",
},
{
fieldName: "status",
dataType: "TEXT",
options: [
"missing",
"issuing",
"active",
"error",
"expiring",
],
defaultValue: "missing",
},
{
fieldName: "last_error",
dataType: "TEXT",
},
{
fieldName: "auto_renew",
dataType: "INTEGER",
options: [0, 1],
defaultValue: 1,
},
],
},
{
tableName: "variables",
fields: [
+58 -1
View File
@@ -6,6 +6,8 @@ export const BunSQLiteTables = [
"clients",
"hosts",
"client_rules",
"client_routes",
"tls_certificates",
"variables",
] as const
@@ -162,6 +164,61 @@ export type BUN_SQLITE_WGUI_CLIENT_RULES = {
protocol?: "any" | "tcp" | "udp" | "";
}
export type BUN_SQLITE_WGUI_CLIENT_ROUTES = {
/**
* The unique identifier of the record.
*/
id?: number | "";
/**
* The time when the record was created. (Unix Timestamp)
*/
created_at?: number | "";
/**
* The time when the record was updated. (Unix Timestamp)
*/
updated_at?: number | "";
user_id?: number | "";
host_id?: number | "";
name?: string;
hostname?: string;
path_prefix?: string;
strip_prefix?: 0 | 1 | "";
upstream_url?: string;
upstream_tls_verify?: 0 | 1 | "";
enabled?: 0 | 1 | "";
notes?: string;
acme_email?: string;
acme_dns_provider?: string;
acme_staging?: 0 | 1 | "";
acme_credentials?: string;
}
export type BUN_SQLITE_WGUI_TLS_CERTIFICATES = {
/**
* The unique identifier of the record.
*/
id?: number | "";
/**
* The time when the record was created. (Unix Timestamp)
*/
created_at?: number | "";
/**
* The time when the record was updated. (Unix Timestamp)
*/
updated_at?: number | "";
user_id?: number | "";
hostname?: string;
provider?: string;
challenge?: string;
dns_provider?: string;
cert_path?: string;
key_path?: string;
expires_at?: number | "";
status?: "missing" | "issuing" | "active" | "error" | "expiring" | "";
last_error?: string;
auto_renew?: 0 | 1 | "";
}
export type BUN_SQLITE_WGUI_VARIABLES = {
/**
* The unique identifier of the record.
@@ -179,4 +236,4 @@ export type BUN_SQLITE_WGUI_VARIABLES = {
value?: string;
}
export type BUN_SQLITE_WGUI_ALL_TYPEDEFS = BUN_SQLITE_WGUI_USERS & BUN_SQLITE_WGUI_USER_TYPES & BUN_SQLITE_WGUI_MEDIA & BUN_SQLITE_WGUI_MEDIA_PARADIGMS & BUN_SQLITE_WGUI_CLIENTS & BUN_SQLITE_WGUI_HOSTS & BUN_SQLITE_WGUI_CLIENT_RULES & BUN_SQLITE_WGUI_VARIABLES
export type BUN_SQLITE_WGUI_ALL_TYPEDEFS = BUN_SQLITE_WGUI_USERS & BUN_SQLITE_WGUI_USER_TYPES & BUN_SQLITE_WGUI_MEDIA & BUN_SQLITE_WGUI_MEDIA_PARADIGMS & BUN_SQLITE_WGUI_CLIENTS & BUN_SQLITE_WGUI_HOSTS & BUN_SQLITE_WGUI_CLIENT_RULES & BUN_SQLITE_WGUI_CLIENT_ROUTES & BUN_SQLITE_WGUI_TLS_CERTIFICATES & BUN_SQLITE_WGUI_VARIABLES