mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-11-27 07:06:03 +01:00
Make the cluster's primary WireGuard option stop the primary server and its gateway in mirror mode
This commit is contained in:
@@ -31,6 +31,16 @@ class ClusterSettings(models.Model):
|
||||
def cluster_enabled(cls):
|
||||
return cls.objects.filter(name='cluster_settings', enabled=True).exists()
|
||||
|
||||
@classmethod
|
||||
def primary_serves_clients(cls):
|
||||
"""
|
||||
False when the primary server neither runs WireGuard nor publishes App Gateway applications, which is only
|
||||
possible in mirror mode: the workers serve every client.
|
||||
"""
|
||||
return not cls.objects.filter(
|
||||
name='cluster_settings', enabled=True, primary_enable_wireguard=False
|
||||
).exclude(cluster_mode__in=DISTRIBUTED_MODES).exists()
|
||||
|
||||
@classmethod
|
||||
def is_distributed(cls):
|
||||
"""Each WireGuard instance runs on a single server. Only applies while the cluster is enabled."""
|
||||
|
||||
Reference in New Issue
Block a user