Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix: update environment variable handling and Dockerfile comments

Andrej Acevski6222ad6080cf
diff --git a/apps/web/.env.production b/apps/web/.env.production
index 4bf50f416..1020abebe 100644
--- a/apps/web/.env.production
+++ b/apps/web/.env.production
@@ -1 +1 @@
-VITE_API_URL=KANEO_API_URL
\ No newline at end of file
+VITE_API_URL="KANEO_API_URL"
\ No newline at end of file
diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile
index 4c997c526..64e3b1fcb 100644
--- a/apps/web/Dockerfile
+++ b/apps/web/Dockerfile
@@ -41,7 +41,7 @@ RUN addgroup -g 1001 appuser && \
mkdir -p /var/run/nginx && \
chown -R appuser:appuser /var/run/nginx && \
chmod -R 755 /var/run/nginx && \
- # Set permissions for nginx configuration
+ # Set permissions for nginx pid file
touch /var/run/nginx.pid && \
chown appuser:appuser /var/run/nginx.pid && \
chmod 644 /var/run/nginx.pid && \
diff --git a/apps/web/env.sh b/apps/web/env.sh
index a48f1a37e..b7d808ce4 100644
--- a/apps/web/env.sh
+++ b/apps/web/env.sh
@@ -1,16 +1,31 @@
#!/bin/sh
set -e
-echo "Replacing environment variables in static files..."
+echo "Starting environment variable replacement..."
-# Process only KANEO_ prefixed environment variables
-for i in $(env | grep KANEO_)
+# Look specifically for the KANEO_API_URL environment variable
+if [ ! -z "$KANEO_API_URL" ]; then
+ echo "Found KANEO_API_URL: $KANEO_API_URL"
+
+ # First, replace the exact string "KANEO_API_URL" in all JavaScript files
+ find /usr/share/nginx/html -type f -name "*.js" -exec grep -l "KANEO_API_URL" {} \; | xargs -I{} sed -i "s|KANEO_API_URL|$KANEO_API_URL|g" {}
+
+ # Also check for the escaped version which might appear in some files
+ find /usr/share/nginx/html -type f -name "*.js" -exec grep -l "\"KANEO_API_URL\"" {} \; | xargs -I{} sed -i "s|\"KANEO_API_URL\"|\"$KANEO_API_URL\"|g" {}
+
+ echo "Replaced KANEO_API_URL with $KANEO_API_URL"
+else
+ echo "WARNING: KANEO_API_URL environment variable is not set. API calls may fail."
+fi
+
+# Process any other KANEO_ prefixed environment variables
+for envvar in $(env | grep KANEO_ | grep -v KANEO_API_URL)
do
- key=$(echo $i | cut -d '=' -f 1)
- value=$(echo $i | cut -d '=' -f 2-)
- echo $key=$value
+ key=$(echo $envvar | cut -d '=' -f 1)
+ value=$(echo $envvar | cut -d '=' -f 2-)
+ echo "Replacing $key with $value"
- find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' +
+ find /usr/share/nginx/html -type f \( -name "*.js" -o -name "*.css" \) -exec sed -i "s|$key|$value|g" {} \;
done
echo "Environment variable replacement complete"
diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts
index ee2923d7f..9f5befe7a 100644
--- a/apps/web/vite.config.ts
+++ b/apps/web/vite.config.ts
@@ -24,4 +24,11 @@ export default defineConfig({
"@": path.resolve(__dirname, "./src"),
},
},
+ build: {
+ rollupOptions: {
+ output: {
+ manualChunks: undefined,
+ },
+ },
+ },
});
diff --git a/packages/libs/src/hono.ts b/packages/libs/src/hono.ts
index 8522aa79b..0944c8f66 100644
--- a/packages/libs/src/hono.ts
+++ b/packages/libs/src/hono.ts
@@ -1,18 +1,15 @@
import type { AppType } from "@kaneo/api";
import { hc } from "hono/client";
-export const client = hc<AppType>(
- import.meta.env.VITE_API_URL ?? "http://localhost:1337",
- {
- fetch: (input: RequestInfo | URL, init?: RequestInit) => {
- return fetch(input, {
- ...init,
- headers: {
- ...init?.headers,
- "Content-Type": "application/json",
- },
- credentials: "include",
- });
- },
+export const client = hc<AppType>("KANEO_API_URL", {
+ fetch: (input: RequestInfo | URL, init?: RequestInit) => {
+ return fetch(input, {
+ ...init,
+ headers: {
+ ...init?.headers,
+ "Content-Type": "application/json",
+ },
+ credentials: "include",
+ });
},
-);
+});