mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
6276883f04
This enhances the existing time.Duration parser to allow multiple units, and implements a decode hook which can be used by koanf to decode string/integers into time.Durations as applicable.
57 lines
2.3 KiB
Go
57 lines
2.3 KiB
Go
package schema
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// RedisNode Represents a Node.
|
|
type RedisNode struct {
|
|
Host string `koanf:"host"`
|
|
Port int `koanf:"port"`
|
|
}
|
|
|
|
// RedisHighAvailabilityConfiguration holds configuration variables for Redis Cluster/Sentinel.
|
|
type RedisHighAvailabilityConfiguration struct {
|
|
SentinelName string `koanf:"sentinel_name"`
|
|
SentinelUsername string `koanf:"sentinel_username"`
|
|
SentinelPassword string `koanf:"sentinel_password"`
|
|
Nodes []RedisNode `koanf:"nodes"`
|
|
RouteByLatency bool `koanf:"route_by_latency"`
|
|
RouteRandomly bool `koanf:"route_randomly"`
|
|
}
|
|
|
|
// RedisSessionConfiguration represents the configuration related to redis session store.
|
|
type RedisSessionConfiguration struct {
|
|
Host string `koanf:"host"`
|
|
Port int `koanf:"port"`
|
|
Username string `koanf:"username"`
|
|
Password string `koanf:"password"`
|
|
DatabaseIndex int `koanf:"database_index"`
|
|
MaximumActiveConnections int `koanf:"maximum_active_connections"`
|
|
MinimumIdleConnections int `koanf:"minimum_idle_connections"`
|
|
TLS *TLSConfig `koanf:"tls"`
|
|
HighAvailability *RedisHighAvailabilityConfiguration `koanf:"high_availability"`
|
|
}
|
|
|
|
// SessionConfiguration represents the configuration related to user sessions.
|
|
type SessionConfiguration struct {
|
|
Name string `koanf:"name"`
|
|
Domain string `koanf:"domain"`
|
|
SameSite string `koanf:"same_site"`
|
|
Secret string `koanf:"secret"`
|
|
Expiration time.Duration `koanf:"expiration"`
|
|
Inactivity time.Duration `koanf:"inactivity"`
|
|
RememberMeDuration time.Duration `koanf:"remember_me_duration"`
|
|
|
|
Redis *RedisSessionConfiguration `koanf:"redis"`
|
|
}
|
|
|
|
// DefaultSessionConfiguration is the default session configuration.
|
|
var DefaultSessionConfiguration = SessionConfiguration{
|
|
Name: "authelia_session",
|
|
Expiration: time.Hour,
|
|
Inactivity: time.Minute * 5,
|
|
RememberMeDuration: time.Hour * 24 * 30,
|
|
SameSite: "lax",
|
|
}
|