diff --git a/broker/fastexact.go b/broker/fastexact.go index ec68efb..dfa97ba 100644 --- a/broker/fastexact.go +++ b/broker/fastexact.go @@ -123,7 +123,7 @@ func (fe FastExact) newRequest(state config.State) (*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=300&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.FastExact.RadiusMiles)+"&st_loc_zip=8", nil, ) if err != nil { @@ -236,8 +236,8 @@ 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") != "300" { - return nil, errors.New("bad query: distance should be 300") + if req.URL.Query().Get("distance") != strconv.Itoa(config.Get().Brokers.FastExact.RadiusMiles) { + return nil, errors.New("bad query: distance should be as configured") } if req.URL.Query().Get("zipcode") == "" { return nil, errors.New("bad query: zip code empty") diff --git a/config.json b/config.json index affa208..a1149ac 100644 --- a/config.json +++ b/config.json @@ -72,6 +72,7 @@ "Once": true, "Brokers": { "FastExact": { + "RadiusMiles": 100, "Enabled": true, "Mock": true, "Username": "u", diff --git a/config.main_test.json b/config.main_test.json index 6dfc6e4..0af08fe 100644 --- a/config.main_test.json +++ b/config.main_test.json @@ -72,6 +72,7 @@ "Once": true, "Brokers": { "FastExact": { + "RadiusMiles": 100, "Enabled": true, "Mock": true, "Username": "u", diff --git a/config/config.go b/config/config.go index 53dd3b4..31c6a34 100644 --- a/config/config.go +++ b/config/config.go @@ -74,10 +74,11 @@ type Config struct { Password string } FastExact struct { - Enabled bool - Mock bool - Username string - Password string + Enabled bool + RadiusMiles int + Mock bool + Username string + Password string } }