Skip to content

Commit c75bfd8

Browse files
committed
fix: Update wizard when using VPN example
1 parent cd47e81 commit c75bfd8

File tree

3 files changed

+45
-21
lines changed

3 files changed

+45
-21
lines changed

src/components/ComposeWizard/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const WizardField = ({ variable, value, onChange, allValues }) => {
134134

135135
// Section component
136136
const WizardSection = ({ section, values, onChange, deploymentType }) => {
137-
const [isCollapsed, setIsCollapsed] = useState(section.collapsed || false);
137+
const [isCollapsed, setIsCollapsed] = useState(section.collapsed || section.id !== 'application');
138138

139139
// Filter variables for current deployment type
140140
const visibleVariables = section.variables.filter((variable) => {

src/data/composeTemplates.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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) => {
144144
const 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);

src/data/composeWizardConfig.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,15 @@ export const WIZARD_SECTIONS = [
276276
],
277277
deploymentTypes: ['modular', 'vpn', 'external-nginx', 'external-caddy'],
278278
},
279+
{
280+
name: 'REDIS_HOST',
281+
label: 'Redis Host',
282+
description: 'Hostname for the Redis service (auto-set based on deployment type)',
283+
type: FIELD_TYPES.TEXT,
284+
default: 'm3u-redis',
285+
showWhen: { field: 'REDIS_MODE', value: 'external' },
286+
deploymentTypes: ['modular', 'vpn', 'external-nginx', 'external-caddy'],
287+
},
279288
{
280289
name: 'REDIS_SERVER_PORT',
281290
label: 'Redis Port',
@@ -614,5 +623,16 @@ export const getDefaultValues = (deploymentType) => {
614623
}
615624
});
616625
});
626+
627+
// Set deployment-type specific defaults
628+
// VPN deployments use 127.0.0.1 for all service hosts (Gluetun network)
629+
if (deploymentType === 'vpn') {
630+
defaults.M3U_PROXY_HOST = '127.0.0.1';
631+
defaults.REDIS_HOST = '127.0.0.1';
632+
} else {
633+
defaults.M3U_PROXY_HOST = 'm3u-proxy';
634+
defaults.REDIS_HOST = 'm3u-redis';
635+
}
636+
617637
return defaults;
618638
};

0 commit comments

Comments
 (0)