mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
Mikrotik integration (#467)
Allow MikroTik routes as WireGuard backends
This commit is contained in:
@@ -44,6 +44,8 @@ type Config struct {
|
||||
LimitAdditionalUserPeers int `yaml:"limit_additional_user_peers"`
|
||||
} `yaml:"advanced"`
|
||||
|
||||
Backend Backend `yaml:"backend"`
|
||||
|
||||
Statistics struct {
|
||||
UsePingChecks bool `yaml:"use_ping_checks"`
|
||||
PingCheckWorkers int `yaml:"ping_check_workers"`
|
||||
@@ -99,6 +101,12 @@ func (c *Config) LogStartupValues() {
|
||||
"minPasswordLength", c.Auth.MinPasswordLength,
|
||||
"hideLoginForm", c.Auth.HideLoginForm,
|
||||
)
|
||||
|
||||
slog.Debug("Config Backend",
|
||||
"defaultBackend", c.Backend.Default,
|
||||
"extraBackends", len(c.Backend.Mikrotik),
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
// defaultConfig returns the default configuration
|
||||
@@ -122,6 +130,10 @@ func defaultConfig() *Config {
|
||||
DSN: "data/sqlite.db",
|
||||
}
|
||||
|
||||
cfg.Backend = Backend{
|
||||
Default: LocalBackendName, // local backend is the default (using wgcrtl)
|
||||
}
|
||||
|
||||
cfg.Web = WebConfig{
|
||||
RequestLogging: false,
|
||||
ExternalUrl: "http://localhost:8888",
|
||||
@@ -201,6 +213,10 @@ func GetConfig() (*Config, error) {
|
||||
}
|
||||
|
||||
cfg.Web.Sanitize()
|
||||
err := cfg.Backend.Validate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user