Add ability to override config file
This commit is contained in:
parent
4a6eb28afd
commit
f556ae0460
2 changed files with 12 additions and 2 deletions
3
TODO.md
3
TODO.md
|
@ -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?
|
9
flags.go
9
flags.go
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue