aboutsummaryrefslogtreecommitdiffhomepage
path: root/cli
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-08-29 20:58:03 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-08-29 21:00:23 -0700
commit6137b401eec5a96101a6acb3c3547e7269d7eeb6 (patch)
tree2557a12fe60f63d22721835976f857bc847eb0f5 /cli
parent41ce0a3b80af2d17aa32e6064b94a7fdf156dea5 (diff)
Make user creation via environment variables idempotent
Diffstat (limited to 'cli')
-rw-r--r--cli/create_admin.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cli/create_admin.go b/cli/create_admin.go
index 372b712..03da6b0 100644
--- a/cli/create_admin.go
+++ b/cli/create_admin.go
@@ -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)