1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-11-29 03:40:32 +01:00

WIP: Predefined users

This commit is contained in:
binwiederhier 2025-07-07 22:36:01 +02:00
parent 3c8ac4a1e1
commit efef587671
5 changed files with 48 additions and 21 deletions

View file

@ -93,6 +93,7 @@ type Config struct {
AuthFile string
AuthStartupQueries string
AuthDefault user.Permission
AuthUsers []user.User
AuthBcryptCost int
AuthStatsQueueWriterInterval time.Duration
AttachmentCacheDir string

View file

@ -189,7 +189,14 @@ func New(conf *Config) (*Server, error) {
}
var userManager *user.Manager
if conf.AuthFile != "" {
userManager, err = user.NewManager(conf.AuthFile, conf.AuthStartupQueries, conf.AuthDefault, conf.AuthBcryptCost, conf.AuthStatsQueueWriterInterval)
authConfig := &user.Config{
Filename: conf.AuthFile,
StartupQueries: conf.AuthStartupQueries,
DefaultAccess: conf.AuthDefault,
BcryptCost: conf.AuthBcryptCost,
QueueWriterInterval: conf.AuthStatsQueueWriterInterval,
}
userManager, err = user.NewManager(authConfig)
if err != nil {
return nil, err
}