mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 21:27:31 +00:00
Use slices
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"os"
|
"os"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -605,7 +606,7 @@ func askForDomain() error {
|
|||||||
|
|
||||||
// Write the new domain to the config file, to allow the user to select it in the future if needed
|
// Write the new domain to the config file, to allow the user to select it in the future if needed
|
||||||
// First check if infiscialConfig.Domains already includes the domain, if it does, do not add it again
|
// First check if infiscialConfig.Domains already includes the domain, if it does, do not add it again
|
||||||
if !util.ArrayContains(infisicalConfig.Domains, domain) {
|
if !slices.Contains(infisicalConfig.Domains, domain) {
|
||||||
infisicalConfig.Domains = append(infisicalConfig.Domains, domain)
|
infisicalConfig.Domains = append(infisicalConfig.Domains, domain)
|
||||||
err = util.WriteConfigFile(&infisicalConfig)
|
err = util.WriteConfigFile(&infisicalConfig)
|
||||||
|
|
||||||
|
|||||||
@@ -298,12 +298,3 @@ func GenerateRandomString(length int) string {
|
|||||||
}
|
}
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ArrayContains(arr []string, val string) bool {
|
|
||||||
for _, item := range arr {
|
|
||||||
if item == val {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user