31 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| # Create output dir if missing
 | |
| mkdir -p /usr/share/nginx/html/assets
 | |
| 
 | |
| # Create a JavaScript config file with environment variables
 | |
| cat > /usr/share/nginx/html/assets/config.js << 'EOL'
 | |
| // Configuration générée automatiquement à partir des variables d'environnement
 | |
| (function(window) {
 | |
|   // API Keys and configuration from environment variables
 | |
|   window.GEMINI_API_KEY = '${GEMINI_API_KEY}';
 | |
|   window.YOUTUBE_API_KEY = '${YOUTUBE_API_KEY}';
 | |
|   window.YOUTUBE_API_KEYS = '${YOUTUBE_API_KEYS}';
 | |
|   window.VIMEO_ACCESS_TOKEN = '${VIMEO_ACCESS_TOKEN}';
 | |
|   window.TWITCH_CLIENT_ID = '${TWITCH_CLIENT_ID}';
 | |
|   window.TWITCH_CLIENT_SECRET = '${TWITCH_CLIENT_SECRET}';
 | |
|   window.YT_CACHE_TTL_MS = '${YT_CACHE_TTL_MS}';
 | |
|   
 | |
|   // Base menu configuration
 | |
|   window.BASE_MENU_CONFIG_ASSETS = '${BASE_MENU_CONFIG_ASSETS:-}';
 | |
| })(window);
 | |
| EOL
 | |
| 
 | |
| # Set proper permissions
 | |
| chmod 644 /usr/share/nginx/html/assets/config.js
 | |
| 
 | |
| # Keep the original env.json for backward compatibility
 | |
| if [ ! -f /usr/share/nginx/html/assets/env.json ]; then
 | |
|   printf '{\n  "BASE_MENU_CONFIG_ASSETS": ""\n}\n' > /usr/share/nginx/html/assets/env.json
 | |
| fi
 |