add per broker enable

master
bel 2022-01-27 15:44:46 -07:00
parent d7339c855e
commit adebff5c40
4 changed files with 16 additions and 6 deletions

View File

@ -72,11 +72,13 @@
"Once": true,
"Brokers": {
"FastExact": {
"Mock": false,
"Username": "birdman",
"Password": "166647"
"Enabled": true,
"Mock": true,
"Username": "u",
"Password": "p"
},
"NTG": {
"Enabled": true,
"JobInfo": true,
"Mock": true,
"LoadPageURIFormat": "https://ntgvision.com/LoadDetails?loadId=%d",

View File

@ -72,11 +72,13 @@
"Once": true,
"Brokers": {
"FastExact": {
"Enabled": true,
"Mock": true,
"Username": "u",
"Password": "p"
},
"NTG": {
"Enabled": true,
"JobInfo": true,
"Mock": true,
"LoadPageURIFormat": "https://ntgvision.com/LoadDetails?loadId=%d",

View File

@ -65,6 +65,7 @@ type Config struct {
Once bool
Brokers struct {
NTG struct {
Enabled bool
JobInfo bool
Mock bool
LoadPageURIFormat string
@ -73,6 +74,7 @@ type Config struct {
Password string
}
FastExact struct {
Enabled bool
Mock bool
Username string
Password string

10
main.go
View File

@ -314,9 +314,13 @@ func once() error {
func getJobs() ([]broker.Job, error) {
states := config.AllStates()
ntg := broker.NewNTGVision()
fe := broker.NewFastExact()
brokers := []broker.Broker{ntg, fe}
brokers := []broker.Broker{}
if config.Get().Brokers.NTG.Enabled {
brokers = append(brokers, broker.NewNTGVision())
}
if config.Get().Brokers.FastExact.Enabled {
brokers = append(brokers, broker.NewFastExact())
}
jobs := []broker.Job{}
for _, broker := range brokers {
somejobs, err := broker.Search(states)