Skip to content

Commit

Permalink
feat: add config to allow muti-net connections on netdesk
Browse files Browse the repository at this point in the history
  • Loading branch information
Aceix committed Mar 5, 2025
1 parent 12580a4 commit 0e89eeb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type ServerConfig struct {
Environment string `yaml:"environment"`
JwtValidityDuration time.Duration `yaml:"jwt_validity_duration" swaggertype:"primitive,integer" format:"int64"`
RacAutoDisable bool `yaml:"rac_auto_disable"`
RacAllowMultipleNetworks bool `yaml:"rac_allow_multiple_networks"`
CacheEnabled string `yaml:"caching_enabled"`
EndpointDetection bool `yaml:"endpoint_detection"`
AllowedEmailDomains string `yaml:"allowed_email_domains"`
Expand Down
2 changes: 2 additions & 0 deletions scripts/netmaker.default.env
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ OIDC_ISSUER=
JWT_VALIDITY_DURATION=43200
# Auto disable a user's connecteds clients bassed on JWT token expiration
RAC_AUTO_DISABLE=false
# Allow a user to connect to multiple networks simultaneously
RAC_ALLOW_MULTIPLE_NETWORKS=false
# if turned on data will be cached on to improve performance significantly (IMPORTANT: If HA set to `false` )
CACHING_ENABLED=true
# if turned on netclient checks if peers are reachable over private/LAN address, and choose that as peer endpoint
Expand Down
2 changes: 1 addition & 1 deletion scripts/nm-quick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ save_config() { (
"INSTALL_TYPE" "NODE_ID" "DNS_MODE" "NETCLIENT_AUTO_UPDATE" "API_PORT"
"CORS_ALLOWED_ORIGIN" "DISPLAY_KEYS" "DATABASE" "SERVER_BROKER_ENDPOINT" "VERBOSITY"
"DEBUG_MODE" "REST_BACKEND" "DISABLE_REMOTE_IP_CHECK" "TELEMETRY" "ALLOWED_EMAIL_DOMAINS" "AUTH_PROVIDER" "CLIENT_ID" "CLIENT_SECRET"
"FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE" "CACHING_ENABLED" "ENDPOINT_DETECTION"
"FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE" "RAC_ALLOW_MULTIPLE_NETWORKS" "CACHING_ENABLED" "ENDPOINT_DETECTION"
"SMTP_HOST" "SMTP_PORT" "EMAIL_SENDER_ADDR" "EMAIL_SENDER_USER" "EMAIL_SENDER_PASSWORD")
for name in "${toCopy[@]}"; do
save_config_item $name "${!name}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/nm-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ save_config() { (
"CORS_ALLOWED_ORIGIN" "DISPLAY_KEYS" "DATABASE" "SERVER_BROKER_ENDPOINT" "STUN_PORT" "VERBOSITY"
"TURN_PORT" "USE_TURN" "DEBUG_MODE" "TURN_API_PORT" "REST_BACKEND"
"DISABLE_REMOTE_IP_CHECK" "TELEMETRY" "AUTH_PROVIDER" "CLIENT_ID" "CLIENT_SECRET"
"FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE")
"FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" "JWT_VALIDITY_DURATION" "RAC_AUTO_DISABLE" "RAC_ALLOW_MULTIPLE_NETWORKS")
for name in "${toCopy[@]}"; do
save_config_item $name "${!name}"
done
Expand Down
6 changes: 6 additions & 0 deletions servercfg/serverconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func GetServerConfig() config.ServerConfig {
}
cfg.JwtValidityDuration = GetJwtValidityDuration()
cfg.RacAutoDisable = GetRacAutoDisable()
cfg.RacAllowMultipleNetworks = GetRacAllowMultipleNetworks()
cfg.MetricInterval = GetMetricInterval()
cfg.ManageDNS = GetManageDNS()
cfg.Stun = IsStunEnabled()
Expand All @@ -120,6 +121,11 @@ func GetRacAutoDisable() bool {
return os.Getenv("RAC_AUTO_DISABLE") == "true"
}

// GetRacAllowMultipleNetworks - returns whether the feature to allow simultaneous network connections via RAC is enabled
func GetRacAllowMultipleNetworks() bool {
return os.Getenv("RAC_ALLOW_MULTIPLE_NETWORKS") == "true"
}

// GetServerInfo - gets the server config into memory from file or env
func GetServerInfo() models.ServerConfig {
var cfg models.ServerConfig
Expand Down

0 comments on commit 0e89eeb

Please sign in to comment.