Added auth

This commit is contained in:
Pijus Kamandulis
2025-07-04 21:05:28 +03:00
parent b3c89a01d0
commit ef247fc843
13 changed files with 297 additions and 80 deletions

View File

@@ -3,21 +3,24 @@ package config
import "flag"
type Config struct {
Port int `json:"port"`
LogPath string `json:"logPath"`
DatabasePath string `json:"databasePath"`
Port int `json:"port"`
LogPath string `json:"logPath"`
DatabasePath string `json:"databasePath"`
AdminPassword string `json:"adminPassword"`
}
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")
adminPassword := flag.String("AdminPassword", "", "Admin password for the web interface, disabled if empty")
flag.Parse()
return Config{
Port: *port,
LogPath: *logPath,
DatabasePath: *databasePath,
Port: *port,
LogPath: *logPath,
DatabasePath: *databasePath,
AdminPassword: *adminPassword,
}
}