mirror of
https://github.com/miniflux/v2.git
synced 2024-09-28 05:11:51 +02:00
Make user creation via environment variables idempotent
This commit is contained in:
parent
41ce0a3b80
commit
6137b401ee
@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"miniflux.app/logger"
|
||||
"miniflux.app/model"
|
||||
"miniflux.app/storage"
|
||||
)
|
||||
@ -27,6 +28,11 @@ func createAdmin(store *storage.Storage) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if store.UserExists(user.Username) {
|
||||
logger.Info(`User %q already exists, skipping creation`, user.Username)
|
||||
return
|
||||
}
|
||||
|
||||
if err := store.CreateUser(user); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user