@@ -65,8 +65,8 @@ const generateEditorEnv = (config, deploymentType) => {
6565 addEnvVar ( envVars , 'M3U_PROXY_ENABLED' , ! proxyExternal ) ;
6666
6767 if ( proxyExternal ) {
68- // External proxy - editor connects to m3u-proxy container
69- addEnvVar ( envVars , 'M3U_PROXY_HOST' , 'm3u-proxy' ) ;
68+ // External proxy - use configured host (127.0.0.1 for VPN, m3u-proxy for others)
69+ addEnvVar ( envVars , 'M3U_PROXY_HOST' , config . M3U_PROXY_HOST || 'm3u-proxy' ) ;
7070 addEnvVar ( envVars , 'M3U_PROXY_PORT' , '8085' ) ; // Internal container port
7171 } else {
7272 // Embedded proxy - runs on localhost inside editor
@@ -81,10 +81,10 @@ const generateEditorEnv = (config, deploymentType) => {
8181 // Redis settings (not for AIO)
8282 if ( deploymentType !== 'aio' ) {
8383 if ( redisExternal ) {
84- // External Redis - editor connects to m3u-redis container
84+ // External Redis - use configured host (127.0.0.1 for VPN, m3u-redis for others)
8585 // Disable embedded Redis since we're using external
8686 addEnvVar ( envVars , 'REDIS_ENABLED' , false ) ;
87- addEnvVar ( envVars , 'REDIS_HOST' , 'm3u-redis' ) ;
87+ addEnvVar ( envVars , 'REDIS_HOST' , config . REDIS_HOST || 'm3u-redis' ) ;
8888 addEnvVar ( envVars , 'REDIS_SERVER_PORT' , config . REDIS_SERVER_PORT || '6379' ) ;
8989 addEnvVar ( envVars , 'REDIS_PASSWORD' , config . REDIS_PASSWORD ) ;
9090 } else {
@@ -144,9 +144,16 @@ const generateVolumes = (config) => {
144144const generateProxyService = ( config , useVpnNetwork = false ) => {
145145 const redisExternal = isRedisExternal ( config ) ;
146146 const imageTag = getImageTag ( config ) ;
147- // When redis is external, proxy connects to m3u-redis container
148- // When redis is internal (embedded in editor), proxy connects to m3u-editor container
149- const redisHost = redisExternal ? 'm3u-redis' : 'm3u-editor' ;
147+ // Use the configured redis host from the form
148+ // For VPN, this will be 127.0.0.1; for others, it will be m3u-redis or m3u-editor
149+ let redisHost ;
150+ if ( redisExternal ) {
151+ redisHost = config . REDIS_HOST || 'm3u-redis' ;
152+ } else {
153+ // Redis is embedded in editor, so proxy needs to connect to editor
154+ // Use 127.0.0.1 for VPN (same network), m3u-editor for others
155+ redisHost = useVpnNetwork ? '127.0.0.1' : 'm3u-editor' ;
156+ }
150157
151158 let service = `
152159 m3u-proxy:
@@ -410,11 +417,13 @@ services:
410417 devices:
411418 - /dev/net/tun:/dev/net/tun
412419 environment:
413- ${ vpnEnv } `;
420+ ${ vpnEnv }
421+ ports:
422+ - "${ config . APP_PORT } :${ config . APP_PORT } " # m3u-editor${ config . XTREAM_ONLY_ENABLED ? `
423+ - "${ config . XTREAM_PORT } :${ config . XTREAM_PORT } " # xtream-only` : '' } `;
414424
415425 if ( proxyExternal ) {
416426 compose += `
417- ports:
418427 - "${ config . M3U_PROXY_PORT || '38085' } :8085" # m3u-proxy` ;
419428 }
420429
@@ -428,25 +437,20 @@ ${vpnEnv}`;
428437 m3u-editor:
429438 image: sparkison/m3u-editor:${ imageTag }
430439 container_name: m3u-editor
440+ network_mode: "service:gluetun"
431441 environment:
432442${ editorEnv }
433443 volumes:
434444${ volumes }
435- ports:
436- - "${ config . APP_PORT } :${ config . APP_PORT } "${ config . XTREAM_ONLY_ENABLED ? `
437- - "${ config . XTREAM_PORT } :${ config . XTREAM_PORT } "` : '' }
438- restart: unless-stopped` ;
445+ restart: unless-stopped
446+ depends_on:
447+ - gluetun` ;
439448
440- if ( editorDependsOn . length > 0 ) {
449+ if ( redisExternal ) {
441450 compose += `
442- depends_on:
443- ${ editorDependsOn . map ( d => ` - ${ d } ` ) . join ( '\n' ) } `;
451+ - m3u-redis` ;
444452 }
445453
446- compose += `
447- networks:
448- - m3u-network` ;
449-
450454 // Add m3u-proxy service if external (runs through VPN)
451455 if ( proxyExternal ) {
452456 compose += generateProxyService ( config , true ) ;
0 commit comments