mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-12 21:06:52 +02:00
Validate single account domain input (#624)
This commit is contained in:
parent
c0a62b6ddc
commit
6b32e2dc07
@ -22,9 +22,10 @@ var (
|
|||||||
disableSingleAccMode bool
|
disableSingleAccMode bool
|
||||||
|
|
||||||
rootCmd = &cobra.Command{
|
rootCmd = &cobra.Command{
|
||||||
Use: "netbird-mgmt",
|
Use: "netbird-mgmt",
|
||||||
Short: "",
|
Short: "",
|
||||||
Long: "",
|
Long: "",
|
||||||
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execution control channel for stopCh signal
|
// Execution control channel for stopCh signal
|
||||||
|
@ -449,6 +449,9 @@ func BuildManager(store Store, peersUpdateManager *PeersUpdateManager, idpManage
|
|||||||
// enable single account mode only if configured by user and number of existing accounts is not grater than 1
|
// enable single account mode only if configured by user and number of existing accounts is not grater than 1
|
||||||
am.singleAccountMode = singleAccountModeDomain != "" && len(allAccounts) <= 1
|
am.singleAccountMode = singleAccountModeDomain != "" && len(allAccounts) <= 1
|
||||||
if am.singleAccountMode {
|
if am.singleAccountMode {
|
||||||
|
if !isDomainValid(singleAccountModeDomain) {
|
||||||
|
return nil, status.Errorf(status.InvalidArgument, "invalid domain \"%s\" provided for single accound mode. Please review your input for --single-account-mode-domain", singleAccountModeDomain)
|
||||||
|
}
|
||||||
am.singleAccountModeDomain = singleAccountModeDomain
|
am.singleAccountModeDomain = singleAccountModeDomain
|
||||||
log.Infof("single account mode enabled, accounts number %d", len(allAccounts))
|
log.Infof("single account mode enabled, accounts number %d", len(allAccounts))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user