fix in agregate
This commit is contained in:
@@ -1198,13 +1198,27 @@ class ConfigGenerator:
|
||||
config += "# " + "="*77 + "\n"
|
||||
config += "\n"
|
||||
|
||||
# MAP BODY
|
||||
for network in all_networks:
|
||||
country = next((c for c, nets in country_networks.items() if network in nets), 'XX')
|
||||
# MAP BODY (aggregate per country to preserve country mapping)
|
||||
for country, nets in sorted(country_networks.items()):
|
||||
if aggregate:
|
||||
nets = ConfigGenerator._aggregate_networks(nets)
|
||||
else:
|
||||
nets = sorted(set(nets))
|
||||
|
||||
for network in nets:
|
||||
config += f"{network} {country}\n"
|
||||
|
||||
return config
|
||||
if redis_ips:
|
||||
redis_list = list(redis_ips)
|
||||
if aggregate:
|
||||
redis_list = ConfigGenerator._aggregate_networks(redis_list)
|
||||
else:
|
||||
redis_list = sorted(set(redis_list))
|
||||
|
||||
for network in redis_list:
|
||||
config += f"{network} REDIS\n"
|
||||
|
||||
return config
|
||||
|
||||
@staticmethod
|
||||
def generate_haproxy_lua(country_networks: dict, aggregate: bool = True, redis_ips: set = None) -> str:
|
||||
|
||||
Reference in New Issue
Block a user