kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1#!/bin/sh
2set -e
3
4echo "Starting environment variable replacement..."
5
6# Process KANEO_API_URL first (with special handling)
7if [ ! -z "$KANEO_API_URL" ]; then
8 echo "Found KANEO_API_URL: $KANEO_API_URL"
9
10 # First, replace the exact string "KANEO_API_URL" in all JavaScript files
11 # Use grep -l to only process files that contain the string
12 find /usr/share/nginx/html -type f -name "*.js" -exec grep -l "KANEO_API_URL" {} \; | xargs -r sed -i "s#KANEO_API_URL#$KANEO_API_URL#g"
13
14 # Also check for the escaped version which might appear in some files
15 find /usr/share/nginx/html -type f -name "*.js" -exec grep -l "\"KANEO_API_URL\"" {} \; | xargs -r sed -i "s#\"KANEO_API_URL\"#\"$KANEO_API_URL\"#g"
16
17 echo "✅ Replaced KANEO_API_URL with $KANEO_API_URL"
18else
19 echo "WARNING: KANEO_API_URL environment variable is not set. API calls may fail."
20fi
21
22# Process KANEO_CLIENT_URL efficiently
23if [ ! -z "$KANEO_CLIENT_URL" ]; then
24 echo "Found KANEO_CLIENT_URL: $KANEO_CLIENT_URL"
25
26 # Only process files that actually contain the string
27 find /usr/share/nginx/html -type f -name "*.js" -exec grep -l "KANEO_CLIENT_URL" {} \; | xargs -r sed -i "s#KANEO_CLIENT_URL#$KANEO_CLIENT_URL#g"
28 find /usr/share/nginx/html -type f -name "*.js" -exec grep -l "\"KANEO_CLIENT_URL\"" {} \; | xargs -r sed -i "s#\"KANEO_CLIENT_URL\"#\"$KANEO_CLIENT_URL\"#g"
29
30 echo "✅ Replaced KANEO_CLIENT_URL with $KANEO_CLIENT_URL"
31fi
32
33# Process any other KANEO_ prefixed environment variables (for future extensibility)
34# Exclude the ones we've already processed
35for key in $(env | grep '^KANEO_' | grep -v 'KANEO_API_URL\|KANEO_CLIENT_URL' | cut -d= -f1); do
36 value=$(printenv "$key")
37
38 if [ ! -z "$value" ]; then
39 echo "Found $key: $value"
40
41 # Only process files that contain this specific key
42 find /usr/share/nginx/html -type f \( -name "*.js" -o -name "*.css" \) -exec grep -l "$key" {} \; | xargs -r sed -i "s#$key#$value#g"
43
44 echo "✅ Replaced $key with $value"
45 fi
46done
47
48echo "✅ Environment variable replacement complete"