Add cleanup, minor fixes
This commit is contained in:
1 parent
97dc0a3570
commit
284e4e7080
7 files changed
+107
-15
No files matched your search
@@ -24,6 +24,11 @@ const (
|
||||
DefaultShortSession = 24 * time.Hour
|
||||
DefaultLongSession = 30 * 24 * time.Hour
|
||||
DefaultTokenSize = 32
|
||||
|
||||
// DefaultCleanupInterval is how often expired sessions, spent/expired
|
||||
// invites and never-activated users are purged in the background. A
|
||||
// non-positive value disables the background cleanup.
|
||||
DefaultCleanupInterval = 1 * time.Hour
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -33,10 +38,14 @@ type Config struct {
|
||||
// to build absolute links (e.g. the avatar URL embedded in Jitsi JWTs).
|
||||
// Leave empty to fall back to the request's Host.
|
||||
PublicBaseURL string
|
||||
Jitsi JitsiConfig
|
||||
Cors CorsConfig
|
||||
Sessions SessionConfig
|
||||
Cookies CookieConfig
|
||||
// CleanupInterval controls the background maintenance loop that purges
|
||||
// expired sessions, spent/expired invites and never-activated users.
|
||||
// Non-positive disables it.
|
||||
CleanupInterval time.Duration
|
||||
Jitsi JitsiConfig
|
||||
Cors CorsConfig
|
||||
Sessions SessionConfig
|
||||
Cookies CookieConfig
|
||||
}
|
||||
|
||||
type JitsiConfig struct {
|
||||
@@ -66,8 +75,9 @@ type CookieConfig struct {
|
||||
|
||||
func DefaultConfig() Config {
|
||||
return Config{
|
||||
Addr: DefaultAddr,
|
||||
DatabasePath: DefaultDatabasePath,
|
||||
Addr: DefaultAddr,
|
||||
DatabasePath: DefaultDatabasePath,
|
||||
CleanupInterval: DefaultCleanupInterval,
|
||||
Jitsi: JitsiConfig{
|
||||
Domain: "meet.jit.si",
|
||||
},
|
||||
@@ -133,6 +143,11 @@ func ConfigFromEnvironment() Config {
|
||||
cfg.Sessions.LongDuration = parsed
|
||||
}
|
||||
}
|
||||
if v := os.Getenv("CLEANUP_INTERVAL"); v != "" {
|
||||
if parsed, err := time.ParseDuration(v); err == nil {
|
||||
cfg.CleanupInterval = parsed
|
||||
}
|
||||
}
|
||||
|
||||
cfg.Jitsi.Secret = os.Getenv("JITSI_SECRET")
|
||||
cfg.Jitsi.AppId = os.Getenv("JITSI_APP_ID")
|
||||
|
||||
Reference in new issue
Block a user