fix: load .env file when ENV is not prod
This commit is contained in:
parent
cc3b454262
commit
abf360a126
|
@ -2,4 +2,6 @@
|
||||||
coverage/*
|
coverage/*
|
||||||
test_monitor.txt
|
test_monitor.txt
|
||||||
bin
|
bin
|
||||||
.vscode
|
.vscode
|
||||||
|
.notes
|
||||||
|
bin
|
8
main.go
8
main.go
|
@ -15,8 +15,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
config := cfg.NewConfig("./.env")
|
envFile := ""
|
||||||
|
if os.Getenv("ENV") != "prod" {
|
||||||
|
envFile = "./.env"
|
||||||
|
}
|
||||||
|
|
||||||
|
config := cfg.NewConfig(envFile)
|
||||||
log.SetFlags(log.Lmicroseconds)
|
log.SetFlags(log.Lmicroseconds)
|
||||||
if config.LogFile {
|
if config.LogFile {
|
||||||
logFileName := fmt.Sprintf("%s.txt", time.Now().Format(strings.ReplaceAll(time.RFC1123Z, ":", "_")))
|
logFileName := fmt.Sprintf("%s.txt", time.Now().Format(strings.ReplaceAll(time.RFC1123Z, ":", "_")))
|
||||||
|
@ -67,7 +71,7 @@ func main() {
|
||||||
mainFrame := page.MustElement("#mainFrame").MustFrame()
|
mainFrame := page.MustElement("#mainFrame").MustFrame()
|
||||||
mainFrame.MustElement("#wlanEnable").MustClick()
|
mainFrame.MustElement("#wlanEnable").MustClick()
|
||||||
log.Println("wlanEnable DONE")
|
log.Println("wlanEnable DONE")
|
||||||
|
return
|
||||||
mainFrame.MustElement("#sysSubmit").MustClick()
|
mainFrame.MustElement("#sysSubmit").MustClick()
|
||||||
// TODO: improve this and wait until something should happens (refresh)
|
// TODO: improve this and wait until something should happens (refresh)
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
|
|
Loading…
Reference in New Issue