24 lines
517 B
Go
24 lines
517 B
Go
package config
|
|
|
|
import "flag"
|
|
|
|
type Config struct {
|
|
Port int `json:"port"`
|
|
LogPath string `json:"logPath"`
|
|
DatabasePath string `json:"databasePath"`
|
|
}
|
|
|
|
func ParseFlags() Config {
|
|
port := flag.Int("Port", 8080, "Listen port")
|
|
logPath := flag.String("LogPath", "logs", "Path to log files")
|
|
databasePath := flag.String("DatabasePath", "badgerdb", "Path to the database directory")
|
|
|
|
flag.Parse()
|
|
|
|
return Config{
|
|
Port: *port,
|
|
LogPath: *logPath,
|
|
DatabasePath: *databasePath,
|
|
}
|
|
}
|