fix: type conversion

This commit is contained in:
Urko. 2023-12-27 07:42:38 +01:00
parent 69389d030b
commit 1dc6ce6e5e
3 changed files with 8 additions and 11 deletions

View File

@ -2,19 +2,18 @@ package cfg
import ( import (
"log" "log"
"time"
"github.com/joho/godotenv" "github.com/joho/godotenv"
"github.com/kelseyhightower/envconfig" "github.com/kelseyhightower/envconfig"
) )
type Config struct { type Config struct {
Page string `required:"true" split_words:"true"` Page string `required:"true" split_words:"true"`
AdminUser string `required:"true" split_words:"true"` AdminUser string `required:"true" split_words:"true"`
Password string `required:"true" split_words:"true"` Password string `required:"true" split_words:"true"`
LogFile bool `required:"true" split_words:"true"` LogFile bool `required:"true" split_words:"true"`
Bin string `required:"true" split_words:"true"` Bin string `required:"true" split_words:"true"`
SubmitDelay time.Duration `default:"7500" required:"false" split_words:"true"` SubmitDelay int `default:"7500" required:"false" split_words:"true"`
} }
func NewConfig(envFilePath string) *Config { func NewConfig(envFilePath string) *Config {

View File

@ -95,7 +95,7 @@ func (p ArcherAx50) SwitchWIFI(cfg provider.SwitchConfig) error {
saveButton.MustClick() saveButton.MustClick()
log.Println(p.saveButtonID, "DONE") log.Println(p.saveButtonID, "DONE")
time.Sleep(time.Millisecond * cfg.SubmitDelay) time.Sleep(time.Millisecond * time.Duration(cfg.SubmitDelay))
return nil return nil
} }

View File

@ -1,12 +1,10 @@
package provider package provider
import "time"
type ProviderIface interface { type ProviderIface interface {
Login(string, string) error Login(string, string) error
SwitchWIFI(SwitchConfig) error SwitchWIFI(SwitchConfig) error
} }
type SwitchConfig struct { type SwitchConfig struct {
SubmitDelay time.Duration SubmitDelay int
} }