diff --git a/broker/fastexact.go b/broker/fastexact.go index 25cf24c..3b4b377 100644 --- a/broker/fastexact.go +++ b/broker/fastexact.go @@ -179,7 +179,7 @@ func (fe FastExact) newRequestWithState(state config.State) (*http.Request, erro func (fe FastExact) newRequest(zip string) (*http.Request, error) { req, err := http.NewRequest( http.MethodGet, - "https://www.fastexact.com/secure/index.php?page=ajaxListJobs&action=ajax&zipcode="+zip+"&records_per_page=50&distance="+strconv.Itoa(config.Get().Brokers.FastExact.RadiusMiles)+"&st_loc_zip=8", + "https://www.fastexact.com/secure/index.php?page=ajaxListJobs&action=ajax&zipcode="+zip+"&records_per_page=50&distance="+strconv.Itoa(config.Get().Brokers.RadiusMiles)+"&st_loc_zip=8", nil, ) if err != nil { @@ -292,7 +292,7 @@ func (mock mockFastExactDoer) doRequest(req *http.Request) (*http.Response, erro if req.URL.Query().Get("records_per_page") != "50" { return nil, errors.New("bad query: records_per_page should be 50") } - if req.URL.Query().Get("distance") != strconv.Itoa(config.Get().Brokers.FastExact.RadiusMiles) { + if req.URL.Query().Get("distance") != strconv.Itoa(config.Get().Brokers.RadiusMiles) { return nil, errors.New("bad query: distance should be as configured") } if req.URL.Query().Get("zipcode") == "" { diff --git a/config.json b/config.json index cd47c30..d812aa1 100644 --- a/config.json +++ b/config.json @@ -75,8 +75,8 @@ "Once": false, "Brokers": { "UseZips": true, + "RadiusMiles": 100, "FastExact": { - "RadiusMiles": 100, "Enabled": true, "Mock": true, "Username": "birdman", diff --git a/config.main_test.json b/config.main_test.json index b666dac..3ada9cb 100644 --- a/config.main_test.json +++ b/config.main_test.json @@ -75,8 +75,8 @@ "Once": true, "Brokers": { "UseZips": true, + "RadiusMiles": 100, "FastExact": { - "RadiusMiles": 100, "Enabled": true, "Mock": true, "Username": "u", diff --git a/config/config.go b/config/config.go index f4c52e6..20bfa2f 100644 --- a/config/config.go +++ b/config/config.go @@ -64,8 +64,9 @@ type Config struct { } Once bool Brokers struct { - UseZips bool - NTG struct { + UseZips bool + RadiusMiles int + NTG struct { Enabled bool JobInfo bool Mock bool @@ -75,11 +76,10 @@ type Config struct { Password string } FastExact struct { - Enabled bool - RadiusMiles int - Mock bool - Username string - Password string + Enabled bool + Mock bool + Username string + Password string } }