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