Better feedback about config

This commit is contained in:
Owen Schwartz
2025-01-15 21:55:18 -05:00
parent 1712b88e18
commit bc69b625fa

11
main.go
View File

@@ -133,9 +133,14 @@ func main() {
logger.Fatal("Failed to parse MTU: %v", err) logger.Fatal("Failed to parse MTU: %v", err)
} }
// Validate that only one config option is provided // are they missing either the config file or the remote config URL?
if (configFile != "" && remoteConfigURL != "") || (configFile == "" && remoteConfigURL == "") { if configFile == "" && remoteConfigURL == "" {
logger.Fatal("Please provide either --config or --remoteConfig, but not both") logger.Fatal("You must provide either a config file or a remote config URL")
}
// do they have both the config file and the remote config URL?
if configFile != "" && remoteConfigURL != "" {
logger.Fatal("You must provide either a config file or a remote config URL, not both")
} }
var key wgtypes.Key var key wgtypes.Key