Skip to content

Commit

Permalink
Added Envirnoment variabel for the --cache flag (STAYRTR_CACHE)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim427 committed Sep 26, 2024
1 parent 44638b8 commit fc73a7f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/stayrtr/stayrtr.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ import (
)

const (
ENV_CACHE = "STAYRTR_CACHE"
ENV_SSH_PASSWORD = "STAYRTR_SSH_PASSWORD"
ENV_SSH_KEY = "STAYRTR_SSH_AUTHORIZEDKEYS"

DEFAULT_CACHE = "https://console.rpki-client.org/rpki.json"

METHOD_NONE = iota
METHOD_PASSWORD
METHOD_KEY
Expand Down Expand Up @@ -80,7 +83,7 @@ var (

TimeCheck = flag.Bool("checktime", true, "Check if JSON file isn't stale (disable by passing -checktime=false)")

CacheBin = flag.String("cache", "https://console.rpki-client.org/rpki.json", "URL of the Validated RPKI data in JSON format")
CacheBin = flag.String("cache", DEFAULT_CACHE, fmt.Sprintf("URL of the Validated RPKI data in JSON format", ENV_CACHE))

Check failure on line 86 in cmd/stayrtr/stayrtr.go

View workflow job for this annotation

GitHub Actions / Build

fmt.Sprintf call has arguments but no formatting directives

Check failure on line 86 in cmd/stayrtr/stayrtr.go

View workflow job for this annotation

GitHub Actions / Build

fmt.Sprintf call has arguments but no formatting directives

Etag = flag.Bool("etag", true, "Control usage of Etag header (disable with -etag=false)")
LastModified = flag.Bool("last.modified", true, "Control usage of Last-Modified header (disable with -last.modified=false)")
Expand Down Expand Up @@ -756,6 +759,11 @@ func run() error {
s.fetchConfig.EnableEtags = *Etag
s.fetchConfig.EnableLastModified = *LastModified

cache := *CacheBin
if cache == DEFAULT_CACHE {
cache = os.Getenv(ENV_CACHE)

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of cache is never used.
}

if enableHTTP {
if *ExportPath != "" {
http.HandleFunc(*ExportPath, s.exporter)
Expand Down

0 comments on commit fc73a7f

Please sign in to comment.