Skip to content

Commit

Permalink
use "location" and "save" tags
Browse files Browse the repository at this point in the history
  • Loading branch information
tedpearson committed Oct 5, 2023
1 parent c258ad3 commit 8a0eefc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ func MakeForecasters(enabled []string, cacheDir string, vcKey string) map[string
// allow http server functionality to be turned off if desired, by not including a port to listen on or something
// also allow proxy to be turned off
// possible to implement precip sums? +probability?
// we may need the ability to match location to proxy by name only.
14 changes: 7 additions & 7 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ func (s *Server) ParseQuery(query string) (*ParsedQuery, error) {
for _, tagMatch := range tagMatches {
tags[tagMatch[1]] = tagMatch[2]
}
adhoc := false
loc, ok := tags["locationTxt"]
adhoc := true
if save := tags["save"]; save == "true" {
adhoc = false
}
loc, ok := tags["location"]
if !ok {
if loc, ok = tags["locationAdhoc"]; !ok {
return nil, errors.New("no location tag found")
}
adhoc = true
return nil, errors.New("no location tag found")
}
location, err := s.LocationService.ParseLocation(loc)
if err != nil {
Expand All @@ -201,7 +201,7 @@ func (s *Server) ParseQuery(query string) (*ParsedQuery, error) {
return pq, nil
}

// ParseParams parses all of the information needed from the prometheus request.
// ParseParams parses all the information needed from the prometheus request.
func (s *Server) ParseParams(Form url.Values) (*Params, error) {
pq, err := s.ParseQuery(Form.Get("query"))
if err != nil {
Expand Down

0 comments on commit 8a0eefc

Please sign in to comment.