mirror of https://github.com/miniflux/v2.git
Make user creation via environment variables idempotent
This commit is contained in:
parent
41ce0a3b80
commit
6137b401ee
|
@ -8,6 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"miniflux.app/logger"
|
||||||
"miniflux.app/model"
|
"miniflux.app/model"
|
||||||
"miniflux.app/storage"
|
"miniflux.app/storage"
|
||||||
)
|
)
|
||||||
|
@ -27,6 +28,11 @@ func createAdmin(store *storage.Storage) {
|
||||||
os.Exit(1)
|
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 {
|
if err := store.CreateUser(user); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in New Issue