fix: type conversion
This commit is contained in:
parent
69389d030b
commit
1dc6ce6e5e
13
cfg/cfg.go
13
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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue