mirror of
https://github.com/h44z/wg-portal.git
synced 2026-09-03 21:36:44 +00:00
This commit is contained in:
+2
-1
@@ -35,6 +35,7 @@ type App struct {
|
||||
|
||||
// Initialize creates a new App instance and initializes it.
|
||||
func Initialize(
|
||||
ctx context.Context,
|
||||
cfg *config.Config,
|
||||
wg WireGuardManager,
|
||||
users UserManager,
|
||||
@@ -46,7 +47,7 @@ func Initialize(
|
||||
users: users,
|
||||
}
|
||||
|
||||
startupContext, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
||||
startupContext, cancel := context.WithTimeout(ctx, cfg.Advanced.StartupTimeout)
|
||||
defer cancel()
|
||||
|
||||
// Switch to admin user context
|
||||
|
||||
@@ -48,6 +48,7 @@ type Config struct {
|
||||
RouteTableOffset int `yaml:"route_table_offset"`
|
||||
ApiAdminOnly bool `yaml:"api_admin_only"` // if true, only admin users can access the API
|
||||
LimitAdditionalUserPeers int `yaml:"limit_additional_user_peers"`
|
||||
StartupTimeout time.Duration `yaml:"startup_timeout"`
|
||||
} `yaml:"advanced"`
|
||||
|
||||
Backend Backend `yaml:"backend"`
|
||||
@@ -190,6 +191,7 @@ func defaultConfig() *Config {
|
||||
cfg.Advanced.RouteTableOffset = getEnvInt("WG_PORTAL_ADVANCED_ROUTE_TABLE_OFFSET", 20000)
|
||||
cfg.Advanced.ApiAdminOnly = getEnvBool("WG_PORTAL_ADVANCED_API_ADMIN_ONLY", true)
|
||||
cfg.Advanced.LimitAdditionalUserPeers = getEnvInt("WG_PORTAL_ADVANCED_LIMIT_ADDITIONAL_USER_PEERS", 0)
|
||||
cfg.Advanced.StartupTimeout = getEnvDuration("WG_PORTAL_ADVANCED_STARTUP_TIMEOUT", 5*time.Minute)
|
||||
|
||||
cfg.Statistics.UsePingChecks = getEnvBool("WG_PORTAL_STATISTICS_USE_PING_CHECKS", true)
|
||||
cfg.Statistics.PingCheckWorkers = getEnvInt("WG_PORTAL_STATISTICS_PING_CHECK_WORKERS", 10)
|
||||
|
||||
Reference in New Issue
Block a user