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
|
* Make scram configurable
|
||||||
* Use reflection in config loading
|
* Use reflection in config loading
|
||||||
* Check export function for improvements
|
* 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?
|
* More slog.Debug and a debug flag?
|
||||||
* Think about timezones
|
* Think about timezones
|
||||||
* Consider more secure auth methods
|
* Consider more secure auth methods
|
||||||
* *Go* dependency-less? <-- this is a terrible idea
|
* *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 (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func FlagInit() {
|
func FlagInit() {
|
||||||
|
config := flag.String("config", "", "override config file")
|
||||||
username := flag.String("user", "", "override username")
|
username := flag.String("user", "", "override username")
|
||||||
password := flag.String("pass", "", "override password")
|
password := flag.String("pass", "", "override password")
|
||||||
port := flag.Int("port", 0, "override port")
|
port := flag.Int("port", 0, "override port")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
if *config != "" {
|
||||||
|
ConfigFile = *config
|
||||||
|
err := Cfg.Reload()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
if *username != "" {
|
if *username != "" {
|
||||||
Cfg.Username = *username
|
Cfg.Username = *username
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue