move radius miles to broker level

master
Bel LaPointe 2022-01-27 17:39:20 -07:00
parent d38555a555
commit a41ea7d501
4 changed files with 11 additions and 11 deletions

View File

@ -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") == "" {

View File

@ -75,8 +75,8 @@
"Once": false,
"Brokers": {
"UseZips": true,
"RadiusMiles": 100,
"FastExact": {
"RadiusMiles": 100,
"Enabled": true,
"Mock": true,
"Username": "birdman",

View File

@ -75,8 +75,8 @@
"Once": true,
"Brokers": {
"UseZips": true,
"RadiusMiles": 100,
"FastExact": {
"RadiusMiles": 100,
"Enabled": true,
"Mock": true,
"Username": "u",

View File

@ -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
}
}