make use of SSL certificates
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 56s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 56s
This commit is contained in:
parent
428db0810f
commit
e39797cf49
2 changed files with 22 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
FROM denoland/deno:debian-2.1.3 AS builder
|
||||
FROM i.sanxian.tech/denoland/deno:debian-2.1.3 AS builder
|
||||
|
||||
ARG TINI_VERSION=0.19.0
|
||||
|
||||
|
@ -16,7 +16,7 @@ RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION
|
|||
RUN deno task compile
|
||||
|
||||
# Stage for creating the non-privileged user
|
||||
FROM alpine:3.20 AS user-stage
|
||||
FROM i.sanxian.tech/alpine:3.20 AS user-stage
|
||||
|
||||
RUN adduser -u 10001 -S appuser
|
||||
|
||||
|
|
25
src/main.ts
25
src/main.ts
|
@ -114,9 +114,24 @@ app.use("*", async (c, next) => {
|
|||
});
|
||||
|
||||
routes(app, konfigStore);
|
||||
const https = Deno.env.get("HTTPS");
|
||||
|
||||
Deno.serve({
|
||||
port: Number(Deno.env.get("PORT")) ||
|
||||
konfigStore.get("server.port") as number,
|
||||
hostname: Deno.env.get("HOST") || konfigStore.get("server.host") as string,
|
||||
}, app.fetch);
|
||||
if (https == "TRUE" || https == "true") {
|
||||
const cert = Deno.readTextFileSync("/data/cert.pem");
|
||||
const key = Deno.readTextFileSync("/data/key.key");
|
||||
Deno.serve({
|
||||
port: Number(Deno.env.get("PORT")) ||
|
||||
konfigStore.get("server.port") as number,
|
||||
hostname: Deno.env.get("HOST") ||
|
||||
konfigStore.get("server.host") as string,
|
||||
cert: cert,
|
||||
key: key,
|
||||
}, app.fetch);
|
||||
} else {
|
||||
Deno.serve({
|
||||
port: Number(Deno.env.get("PORT")) ||
|
||||
konfigStore.get("server.port") as number,
|
||||
hostname: Deno.env.get("HOST") ||
|
||||
konfigStore.get("server.host") as string,
|
||||
}, app.fetch);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue