Default IPv6 by environment variable

This commit is contained in:
Simon 2021-07-09 01:39:52 +01:00
parent 4742b78fd0
commit fb1032e116
2 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import const
import socket import socket
import ipaddress import ipaddress
from socket import gethostbyname from socket import gethostbyname
import os
# Does anybody read this stuff? There's a PEP somewhere that says I should do this. # Does anybody read this stuff? There's a PEP somewhere that says I should do this.
@ -330,6 +331,10 @@ def build_config(_config_file):
'ENHANCED_OBP': config.getboolean(section, 'ENHANCED_OBP') 'ENHANCED_OBP': config.getboolean(section, 'ENHANCED_OBP')
}}) }})
#If IPv6 is enabled by enviornment variable...
if CONFIG['SYSTEMS'][section]['IP'] == '' and 'FD_DEFAULT_IPV6' in os.environ and bool(os.environ['FD_DEFAULT_IPV6']):
CONFIG['SYSTEMS'][section]['IP'] = '::'
try: try:
if CONFIG['SYSTEMS'][section]['IP'] == '::': if CONFIG['SYSTEMS'][section]['IP'] == '::':

View File

@ -23,6 +23,7 @@ services:
ipv6_address: fd2a:70b6:9f54:29b6::10 ipv6_address: fd2a:70b6:9f54:29b6::10
environment: environment:
- FDPROXY_IPV6=1 - FDPROXY_IPV6=1
- FD_DEFAULT_IPV6=1
ipv6nat: ipv6nat:
container_name: ipv6nat container_name: ipv6nat