Add ability to override config file

This commit is contained in:
Andrew-71 2024-03-26 18:26:34 +03:00
parent 4a6eb28afd
commit f556ae0460
2 changed files with 12 additions and 2 deletions

View file

@ -4,8 +4,9 @@ List of things to add to this project
* Make scram configurable
* Use reflection in config loading
* Check export function for improvements
* Improve viewing of data (textarea over raw API requests)
* Improve viewing of days (textarea over raw API requests), add notes to frontend
* More slog.Debug and a debug flag?
* Think about timezones
* Consider more secure auth methods
* *Go* dependency-less? <-- this is a terrible idea
* Better visual feedback from JS?

View file

@ -2,14 +2,23 @@ package main
import (
"flag"
"log"
)
func FlagInit() {
config := flag.String("config", "", "override config file")
username := flag.String("user", "", "override username")
password := flag.String("pass", "", "override password")
port := flag.Int("port", 0, "override port")
flag.Parse()
if *config != "" {
ConfigFile = *config
err := Cfg.Reload()
if err != nil {
log.Fatal(err)
}
}
if *username != "" {
Cfg.Username = *username
}