integrated Gorilla session support

This commit is contained in:
2025-09-17 22:50:30 -06:00
parent 522afc33ed
commit 877f364e71
8 changed files with 108 additions and 12 deletions
+31
View File
@@ -0,0 +1,31 @@
/*
* Amsterdam Web Communities System
* Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
// Package ui holds the support for the Amsterdam user interface, wrapping Echo and Jet templates.
package ui
import (
"git.erbosoft.com/amy/amsterdam/config"
"github.com/gorilla/sessions"
log "github.com/sirupsen/logrus"
)
// SessionStore is the Gorilla session store used by Amsterdam.
var SessionStore sessions.Store
// SetupSessionManager sets up the session manager.
func SetupSessionManager() {
log.Infof("Cookie key is %s", config.GlobalConfig.Rendering.CookieKey)
SessionStore = sessions.NewCookieStore([]byte(config.GlobalConfig.Rendering.CookieKey))
}
// SetupAmSession sets up a newly created Amsterdam session.
func SetupAmSession(session *sessions.Session) {
session.Values["temp"] = "Active"
}