remove config ntg token from code

This commit is contained in:
Bel LaPointe
2022-01-14 08:43:41 -05:00
parent c1cdc6dc0c
commit cf421e414c
3 changed files with 11 additions and 7 deletions

View File

@@ -188,14 +188,19 @@ func (ntg NTGVision) Search(states []config.State) ([]Job, error) {
return jobs, err
}
func getNTGTokenKey() string {
return "brokers_ntg_token"
}
func getNTGToken() string {
return config.Get().Brokers.NTG.Token
db := config.Get().DB()
b, _ := db.Get(getNTGTokenKey())
return string(b)
}
func setNTGToken(token string) {
conf := config.Get()
conf.Brokers.NTG.Token = token
config.Set(*conf)
db := config.Get().DB()
db.Set(getNTGTokenKey(), []byte(token))
}
func (ntg NTGVision) search(states []config.State) (io.ReadCloser, error) {
@@ -215,6 +220,7 @@ func (ntg NTGVision) search(states []config.State) (io.ReadCloser, error) {
}
func (ntg NTGVision) refreshAuth() error {
log.Printf("refreshing ntg auth...")
b, _ := json.Marshal(map[string]string{
"username": config.Get().Brokers.NTG.Username,
"password": config.Get().Brokers.NTG.Password,