fedilogue/fedilogger/config.go

32 lines
738 B
Go
Raw Normal View History

2020-12-05 23:59:32 -05:00
package main
import (
2025-01-22 02:21:12 +00:00
"flag"
2020-12-05 23:59:32 -05:00
)
2020-12-17 04:23:25 +00:00
// Settings - Configuration file structure
2020-12-05 23:59:32 -05:00
type Settings struct {
2025-01-22 02:21:12 +00:00
Crawl bool
LogLevel int
Hostname string
2020-12-05 23:59:32 -05:00
}
var settings Settings
2021-09-29 06:43:06 +00:00
/* Test: TestStringexists */
2020-12-17 04:23:25 +00:00
func stringexists(needle string, haystack []string) bool {
2020-12-05 23:59:32 -05:00
for _, check := range haystack {
if check == needle {
return true
}
}
return false
}
func getSettings() {
2025-01-22 02:21:12 +00:00
flag.BoolVar(&settings.Crawl, "c", true, "Crawl mode (default is yes)")
flag.StringVar(&settings.Hostname, "h", "myhostname", "Set your hostname")
flag.IntVar(&settings.LogLevel, "l", 1, "Logging Level:\n 0) No logs\n 1) Reports every 30 seconds\n 2) Errors\n 3) Warnings\n 4) New Connections\n 5) Debugging\n")
flag.Parse()
2020-12-05 23:59:32 -05:00
}