From 420c7111554d5845c940d0f7426790c498e824aa Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Fri, 14 Feb 2025 13:27:50 +0100 Subject: [PATCH] fix(turborepo): passthrough HD_* env vars by config option It seems there's a bug in turborepo which results in turbo not passing through arbitrary environment variables despite --env-mode=loose being set. This config option resolves the problem by passing through all HedgeDoc environment variables prefixed by `HD_`. This somewhat also enhances stability and reproducability of builds since other env vars wouldn't interfere anymore. The additional variable CADDY_HOST is required to make overriding the listening port in our Caddyfile work. Signed-off-by: Erik Michelson --- package.json | 20 ++++++++++---------- turbo.json | 4 ++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 9fd28776f..f58551175 100644 --- a/package.json +++ b/package.json @@ -12,16 +12,16 @@ "markdown-it-plugins" ], "scripts": { - "build": "dotenv -c production -- turbo --env-mode=loose run build", - "build:test": "dotenv -c production -- turbo --env-mode=loose run build:test", - "lint": "dotenv -c development -- turbo --env-mode=loose run lint", - "lint:fix": "dotenv -c development -- turbo --env-mode=loose run lint:fix", - "format": "dotenv -c development -- turbo --env-mode=loose run format", - "start:dev": "dotenv -c development -- turbo --env-mode=loose run start:dev", - "start": "dotenv -c production -- turbo --env-mode=loose run start", - "test:ci": "dotenv -c test -- turbo --env-mode=loose run test:ci --concurrency 1", - "test": "dotenv -c test -- turbo --env-mode=loose run test --concurrency 1", - "test:e2e:ci": "dotenv -c test -- turbo --env-mode=loose run test:e2e:ci" + "build": "dotenv -c production -- turbo run build", + "build:test": "dotenv -c production -- turbo run build:test", + "lint": "dotenv -c development -- turbo run lint", + "lint:fix": "dotenv -c development -- turbo run lint:fix", + "format": "dotenv -c development -- turbo run format", + "start:dev": "dotenv -c development -- turbo run start:dev", + "start": "dotenv -c production -- turbo run start", + "test:ci": "dotenv -c test -- turbo run test:ci --concurrency 1", + "test": "dotenv -c test -- turbo run test --concurrency 1", + "test:e2e:ci": "dotenv -c test -- turbo run test:e2e:ci" }, "packageManager": "yarn@4.5.3", "resolutions": { diff --git a/turbo.json b/turbo.json index 9123241fa..8f2e8eb1e 100644 --- a/turbo.json +++ b/turbo.json @@ -1,5 +1,9 @@ { "$schema": "https://turbo.build/schema.json", + "globalPassThroughEnv": [ + "HD_*", + "CADDY_HOST" + ], "tasks": { "build": {}, "@hedgedoc/html-to-react#build": {