1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-28 01:15:43 +02:00

Docs, LoadConfig, config test

This commit is contained in:
Philipp Heckel 2021-12-22 13:46:17 +01:00
parent 66c749d5f0
commit 68d881291c
11 changed files with 130 additions and 41 deletions

View file

@ -18,7 +18,7 @@ var (
random = rand.New(rand.NewSource(time.Now().UnixNano()))
randomMutex = sync.Mutex{}
errInvalidPriority = errors.New("unknown priority")
errInvalidPriority = errors.New("invalid priority")
)
// FileExists checks if a file exists, and returns true if it does
@ -50,6 +50,16 @@ func InStringListAll(haystack []string, needles []string) bool {
return matches == len(needles)
}
// InIntList returns true if needle is contained in haystack
func InIntList(haystack []int, needle int) bool {
for _, s := range haystack {
if s == needle {
return true
}
}
return false
}
// SplitNoEmpty splits a string using strings.Split, but filters out empty strings
func SplitNoEmpty(s string, sep string) []string {
res := make([]string, 0)