fix - carto now requires api keys
This commit is contained in:
parent
9cfec42104
commit
3a3307e190
9 changed files with 100 additions and 6 deletions
|
|
@ -25,6 +25,7 @@ var (
|
|||
flagGeoIP string
|
||||
flagSplitByDay bool
|
||||
flagTheme string
|
||||
flagMapAPIKey string
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
|
|
@ -46,6 +47,8 @@ func init() {
|
|||
rootCmd.Flags().BoolVar(&flagSplitByDay, "split-by-day", false, "Write one HTML report per calendar day plus an index page")
|
||||
rootCmd.Flags().StringVar(&flagTheme, "theme", report.DefaultTheme,
|
||||
"Report visual theme ("+strings.Join(report.ThemeNames(), ", ")+")")
|
||||
rootCmd.Flags().StringVar(&flagMapAPIKey, "map-api-key", os.Getenv("NXSTATS_MAP_API_KEY"),
|
||||
"CARTO basemap API key, appended to map tile URLs as ?key= (env: NXSTATS_MAP_API_KEY)")
|
||||
}
|
||||
|
||||
// validateTheme returns an error if name is not a recognized theme.
|
||||
|
|
@ -108,6 +111,7 @@ func runE(cmd *cobra.Command, args []string) error {
|
|||
AccessEntries: accessEntries,
|
||||
ErrorEntries: errorEntries,
|
||||
Theme: flagTheme,
|
||||
MapAPIKey: flagMapAPIKey,
|
||||
}
|
||||
report.ComputeStats(&data)
|
||||
|
||||
|
|
@ -212,6 +216,7 @@ func runSplitByDay(
|
|||
for i := range days {
|
||||
days[i].Data.IndexFile = indexBase
|
||||
days[i].Data.DayTitle = days[i].Date.Format("2006-01-02")
|
||||
days[i].Data.MapAPIKey = flagMapAPIKey
|
||||
|
||||
// Per-day geo: set Count from this day's access entries
|
||||
if len(geoPoints) > 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue