Fix initialization of conf for stats
This commit is contained in:
parent
7001fa4fa5
commit
8ce11fa824
@ -21,18 +21,20 @@ type StatsData struct {
|
||||
}
|
||||
|
||||
var (
|
||||
key = []byte(securecookie.GenerateRandomKey(32))
|
||||
store = sessions.NewCookieStore(key)
|
||||
conf = config.LoadedConfig()
|
||||
store *sessions.CookieStore
|
||||
conf *config.Config
|
||||
)
|
||||
|
||||
func init() {
|
||||
func statsInitialize(c *config.Config) {
|
||||
key := []byte(securecookie.GenerateRandomKey(32))
|
||||
store = sessions.NewCookieStore(key)
|
||||
store.Options = &sessions.Options{
|
||||
Path: conf.BaseURL+"/stats",
|
||||
Path: c.BaseURL + "/stats",
|
||||
MaxAge: 3600 * 1, // 1 hour
|
||||
HttpOnly: true,
|
||||
SameSite: http.SameSiteStrictMode,
|
||||
}
|
||||
conf = c
|
||||
}
|
||||
|
||||
func Stats(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -87,6 +87,7 @@ type IPInfoResponse struct {
|
||||
}
|
||||
|
||||
func Initialize(c *config.Config) {
|
||||
statsInitialize(c)
|
||||
// changed to use Noto Sans instead of OpenSans, due to issue:
|
||||
// https://github.com/golang/freetype/issues/8
|
||||
fLight, err := freetype.ParseFont(fontLightBytes)
|
||||
|
Loading…
Reference in New Issue
Block a user