fix: load .env file when ENV is not prod

This commit is contained in:
Urko 2023-03-02 18:39:53 +01:00
parent cc3b454262
commit abf360a126
2 changed files with 9 additions and 3 deletions

4
.gitignore vendored
View File

@ -2,4 +2,6 @@
coverage/*
test_monitor.txt
bin
.vscode
.vscode
.notes
bin

View File

@ -15,8 +15,12 @@ import (
)
func main() {
config := cfg.NewConfig("./.env")
envFile := ""
if os.Getenv("ENV") != "prod" {
envFile = "./.env"
}
config := cfg.NewConfig(envFile)
log.SetFlags(log.Lmicroseconds)
if config.LogFile {
logFileName := fmt.Sprintf("%s.txt", time.Now().Format(strings.ReplaceAll(time.RFC1123Z, ":", "_")))
@ -67,7 +71,7 @@ func main() {
mainFrame := page.MustElement("#mainFrame").MustFrame()
mainFrame.MustElement("#wlanEnable").MustClick()
log.Println("wlanEnable DONE")
return
mainFrame.MustElement("#sysSubmit").MustClick()
// TODO: improve this and wait until something should happens (refresh)
time.Sleep(time.Second * 3)