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, "Once": true,
"Brokers": { "Brokers": {
"FastExact": { "FastExact": {
"Mock": false, "Enabled": true,
"Username": "birdman", "Mock": true,
"Password": "166647" "Username": "u",
"Password": "p"
}, },
"NTG": { "NTG": {
"Enabled": true,
"JobInfo": true, "JobInfo": true,
"Mock": true, "Mock": true,
"LoadPageURIFormat": "https://ntgvision.com/LoadDetails?loadId=%d", "LoadPageURIFormat": "https://ntgvision.com/LoadDetails?loadId=%d",

View File

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

View File

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

10
main.go
View File

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