From f1143e54a06e00a348e37b5633fad4cb6390cff7 Mon Sep 17 00:00:00 2001 From: Yuichi Nakai Date: Fri, 11 Jul 2025 05:28:33 +0900 Subject: [PATCH] fix: unable to change certificate path for running from source (#3582) Co-authored-by: Meier Lukas --- .env.example | 7 ++++++- packages/certificates/src/server.ts | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index e78c567a6..28fa9d4de 100644 --- a/.env.example +++ b/.env.example @@ -12,6 +12,10 @@ AUTH_SECRET="supersecret" # or starting the project without any (which will show a randomly generated one). SECRET_ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000 +# Cron job API key is generated every time the container starts as it is required for communication between nextjs-api and tasks-api +# export CRON_JOB_API_KEY=$(openssl rand -base64 32) +# CRON_JOB_API_KEY="your-generated-api-key" + LOG_LEVEL='info' # This is how you can use the sqlite driver: @@ -30,7 +34,8 @@ DB_URL='FULL_PATH_TO_YOUR_SQLITE_DB_FILE' # DB_PASSWORD='password' # DB_NAME='name-of-database' -# The below path can be used to store trusted certificates during development, it is not required and can be left empty. +# The below path can be used to store trusted certificates, it is not required and can be left empty. +# If it is empty, it will default to `/appdata/trusted-certificates` in production. # If it is used, please use the full path to the directory where the certificates are stored. # LOCAL_CERTIFICATE_PATH='FULL_PATH_TO_CERTIFICATES' diff --git a/packages/certificates/src/server.ts b/packages/certificates/src/server.ts index 73f0f9205..419a382c0 100644 --- a/packages/certificates/src/server.ts +++ b/packages/certificates/src/server.ts @@ -15,9 +15,8 @@ import { db } from "@homarr/db"; import type { trustedCertificateHostnames } from "@homarr/db/schema"; const getCertificateFolder = () => { - return env.NODE_ENV === "production" - ? path.join("/appdata", "trusted-certificates") - : process.env.LOCAL_CERTIFICATE_PATH; + if (env.NODE_ENV !== "production") return process.env.LOCAL_CERTIFICATE_PATH; + return process.env.LOCAL_CERTIFICATE_PATH ?? path.join("/appdata", "trusted-certificates"); }; export const loadCustomRootCertificatesAsync = async () => {