ntg confirmed ok, back to mock
parent
1320bd1884
commit
afa1bdf56f
|
|
@ -114,7 +114,7 @@ func (ntg NTGVision) newRequest(states []config.State) (*http.Request, error) {
|
||||||
"MaxNumberOfStopsLimit": nil,
|
"MaxNumberOfStopsLimit": nil,
|
||||||
"MaxWeightLimit": nil,
|
"MaxWeightLimit": nil,
|
||||||
"MinMilesLimit": nil,
|
"MinMilesLimit": nil,
|
||||||
"SavedSearchId": nil, ///2956,
|
"SavedSearchId": 2956,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -128,7 +128,7 @@ func (ntg NTGVision) newRequest(states []config.State) (*http.Request, error) {
|
||||||
request.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
request.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
||||||
request.Header.Set("Accept-Encoding", "gzip, deflate, br")
|
request.Header.Set("Accept-Encoding", "gzip, deflate, br")
|
||||||
request.Header.Set("Content-Type", "application/json;charset=utf-8")
|
request.Header.Set("Content-Type", "application/json;charset=utf-8")
|
||||||
request.Header.Set("Authorization", strings.Split(strings.Split(config.Get().Brokers.NTG.Cookie, "; NTGAuthToken=")[1], "; ")[0])
|
request.Header.Set("Authorization", "Bearer "+strings.Split(strings.Split(config.Get().Brokers.NTG.Cookie, "; NTGAuthToken=")[1], "; ")[0])
|
||||||
request.Header.Set("Origin", "https://ntgvision.com")
|
request.Header.Set("Origin", "https://ntgvision.com")
|
||||||
request.Header.Set("DNT", "1")
|
request.Header.Set("DNT", "1")
|
||||||
request.Header.Set("Connection", "keep-alive")
|
request.Header.Set("Connection", "keep-alive")
|
||||||
|
|
|
||||||
10
config.json
10
config.json
|
|
@ -1,5 +1,11 @@
|
||||||
{
|
{
|
||||||
"Interval": "1s",
|
"Interval": "1s",
|
||||||
"States": ["NC"],
|
"States": ["OH", "CA"],
|
||||||
"Once": true
|
"Once": true,
|
||||||
|
"Brokers": {
|
||||||
|
"NTG": {
|
||||||
|
"Mock": true,
|
||||||
|
"Cookie": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ type Config struct {
|
||||||
Once bool
|
Once bool
|
||||||
Brokers struct {
|
Brokers struct {
|
||||||
NTG struct {
|
NTG struct {
|
||||||
|
Mock bool
|
||||||
Cookie string
|
Cookie string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
main.go
6
main.go
|
|
@ -56,7 +56,11 @@ func once() error {
|
||||||
|
|
||||||
func getJobs() ([]broker.Job, error) {
|
func getJobs() ([]broker.Job, error) {
|
||||||
states := config.Get().States
|
states := config.Get().States
|
||||||
brokers := []broker.Broker{broker.NewNTGVision().WithMock()}
|
ntg := broker.NewNTGVision()
|
||||||
|
if config.Get().Brokers.NTG.Mock {
|
||||||
|
ntg = ntg.WithMock()
|
||||||
|
}
|
||||||
|
brokers := []broker.Broker{ntg}
|
||||||
jobs := []broker.Job{}
|
jobs := []broker.Job{}
|
||||||
for _, broker := range brokers {
|
for _, broker := range brokers {
|
||||||
somejobs, err := broker.Search(states)
|
somejobs, err := broker.Search(states)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue