updated documentation
Dieser Commit ist enthalten in:
Ursprung
207a7ff58a
Commit
5c33058038
|
@ -0,0 +1,3 @@
|
||||||
|
// Package auth is for the abstraction of the authentication method.
|
||||||
|
// this enables the application developer to seperate the authentication from the authentication itself.
|
||||||
|
package auth
|
|
@ -0,0 +1,14 @@
|
||||||
|
package constants
|
||||||
|
|
||||||
|
// AccountConstant is an type for easier linting.
|
||||||
|
type AccountConstant string
|
||||||
|
|
||||||
|
// These are Constants to save specific attributes in single points of use.
|
||||||
|
const (
|
||||||
|
// AccountID is the ID of the session. Prefferably it should be an UUIDv4 to mitigate security errors.
|
||||||
|
AccountID AccountConstant = "jti"
|
||||||
|
// AccountAnon is to identify Sessions as Anonymous sessions.
|
||||||
|
AccountAnon AccountConstant = "anon"
|
||||||
|
// AccountUser is an attribute that identifies the user with an string that is unique for the user, for Example the username.
|
||||||
|
AccountUser AccountConstant = "uid"
|
||||||
|
)
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Package constants provides static aliases when an value from an enum is required
|
||||||
|
package constants
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Package httpserver provides developers with an HTTP-Server that route parts of the site on different domains and is configurable after the build
|
||||||
|
package httpserver
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Package funcs provides fome functions that for special cases
|
||||||
|
package funcs
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Package menus provides an abstraction for providing an global menu that covers multiple sites
|
||||||
|
package menus
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Package db is an middleware that manages multiple database pools and provides applications with an way to access the database
|
||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -31,7 +32,7 @@ type Middleware struct {
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
//NewMiddleware return an initialized Middleware Object.
|
// NewMiddleware return an initialized Middleware Object.
|
||||||
func NewMiddleware() *Middleware {
|
func NewMiddleware() *Middleware {
|
||||||
return &Middleware{
|
return &Middleware{
|
||||||
databases: make(map[string]*pgxpool.Pool),
|
databases: make(map[string]*pgxpool.Pool),
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Package middleware provides some middleware
|
||||||
|
package middleware
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"go.sebtobie.de/httpserver/constants"
|
"go.sebtobie.de/httpserver/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LogMiddleware is an middleware to log requests to phuslu/log and catches panics.
|
// LogMiddleware is an middleware to log requests to rs/zerolog and catches panics.
|
||||||
// If it is added multiple times, only the first time sends entries to the log.
|
// If it is added multiple times, only the first time sends entries to the log.
|
||||||
func LogMiddleware(c *gin.Context) {
|
func LogMiddleware(c *gin.Context) {
|
||||||
if _, exists := c.Get("xid"); exists {
|
if _, exists := c.Get("xid"); exists {
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Package saml provides an Authentication Handler for authenticating over SAML
|
||||||
|
package saml
|
4
site.go
4
site.go
|
@ -11,13 +11,17 @@ type Site interface {
|
||||||
// ConfigSite is for sites that have to be configured
|
// ConfigSite is for sites that have to be configured
|
||||||
type ConfigSite interface {
|
type ConfigSite interface {
|
||||||
Site
|
Site
|
||||||
|
// Defaults returns the default values for the configuration
|
||||||
Defaults() SiteConfig
|
Defaults() SiteConfig
|
||||||
|
// Setup configures the Site with the read configuration.
|
||||||
|
// For the order how the methods are called refer to [Server.Setup]
|
||||||
Setup(SiteConfig) error
|
Setup(SiteConfig) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// TeardownSite is for sites that require to do steps before shutdown
|
// TeardownSite is for sites that require to do steps before shutdown
|
||||||
type TeardownSite interface {
|
type TeardownSite interface {
|
||||||
Site
|
Site
|
||||||
|
// Teardown is called before shutting down the server. Its for gracefully shutdowns of goroutines or longstanding connections
|
||||||
Teardown()
|
Teardown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Package templates helps sites to manage their templates
|
||||||
package templates
|
package templates
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -19,7 +20,7 @@ var (
|
||||||
_ pongo2.TemplateLoader = &EmptyLoader{}
|
_ pongo2.TemplateLoader = &EmptyLoader{}
|
||||||
)
|
)
|
||||||
|
|
||||||
//TemplateSite is an interface that is for storing templates.
|
// TemplateSite is an interface that is for storing templates.
|
||||||
type TemplateSite interface {
|
type TemplateSite interface {
|
||||||
Templates() pongo2.TemplateLoader
|
Templates() pongo2.TemplateLoader
|
||||||
}
|
}
|
||||||
|
|
Laden…
In neuem Issue referenzieren