diff --git a/cfg/cfg.go b/cfg/cfg.go index c053ef8..f5b6c1a 100644 --- a/cfg/cfg.go +++ b/cfg/cfg.go @@ -2,19 +2,18 @@ package cfg import ( "log" - "time" "github.com/joho/godotenv" "github.com/kelseyhightower/envconfig" ) type Config struct { - Page string `required:"true" split_words:"true"` - AdminUser string `required:"true" split_words:"true"` - Password string `required:"true" split_words:"true"` - LogFile bool `required:"true" split_words:"true"` - Bin string `required:"true" split_words:"true"` - SubmitDelay time.Duration `default:"7500" required:"false" split_words:"true"` + Page string `required:"true" split_words:"true"` + AdminUser string `required:"true" split_words:"true"` + Password string `required:"true" split_words:"true"` + LogFile bool `required:"true" split_words:"true"` + Bin string `required:"true" split_words:"true"` + SubmitDelay int `default:"7500" required:"false" split_words:"true"` } func NewConfig(envFilePath string) *Config { diff --git a/internal/providers/archer_ax50.go b/internal/providers/archer_ax50.go index 43fb74d..1ed7acc 100644 --- a/internal/providers/archer_ax50.go +++ b/internal/providers/archer_ax50.go @@ -95,7 +95,7 @@ func (p ArcherAx50) SwitchWIFI(cfg provider.SwitchConfig) error { saveButton.MustClick() log.Println(p.saveButtonID, "DONE") - time.Sleep(time.Millisecond * cfg.SubmitDelay) + time.Sleep(time.Millisecond * time.Duration(cfg.SubmitDelay)) return nil } diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index 59f8051..1c67b64 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -1,12 +1,10 @@ package provider -import "time" - type ProviderIface interface { Login(string, string) error SwitchWIFI(SwitchConfig) error } type SwitchConfig struct { - SubmitDelay time.Duration + SubmitDelay int }