Make user creation via environment variables idempotent
This commit is contained in:
parent
41ce0a3b80
commit
6137b401ee
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue