host now defaults to "localhost"

loglevel flag now uses logrus constants (0 up to 6)

config values are only applied if the corresponding flag wasn't passed
isFlagPassed() added to util.go
This commit is contained in:
2024-06-28 06:55:53 +01:00
parent 31b188280d
commit 2bdabdae03
2 changed files with 41 additions and 42 deletions

12
util.go
View File

@@ -1,5 +1,7 @@
package main
import "flag"
// indexOf returns the index of an element in an array
func indexOf[T comparable](collection []T, e T) int {
for i, x := range collection {
@@ -9,3 +11,13 @@ func indexOf[T comparable](collection []T, e T) int {
}
return -1
}
func isFlagPassed(name string) bool {
found := false
flag.Visit(func(f *flag.Flag) {
if f.Name == name {
found = true
}
})
return found
}