Skip to content

Commit 18c5e29

Browse files
committed
added new admin user when starting the dev server
1 parent e109971 commit 18c5e29

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cmd/server.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,20 @@ func startServer(port string) {
121121
http.Handle("/storage/upload", chain(http.HandlerFunc(svr.upload), svr.sb, svr.logger, svr.cors))
122122
http.Handle("/_servefile_/", chain(http.HandlerFunc(svr.serveFile), svr.logger, svr.cors))
123123

124+
// we create an admin
125+
users := make([]map[string]interface{}, 0)
126+
newUser := make(map[string]interface{})
127+
newUser["accountId"] = 1
128+
newUser["userId"] = 1
129+
newUser["email"] = "a@b.com"
130+
newUser["password"] = "test123"
131+
newUser["role"] = 100
132+
133+
users = append(users, newUser)
134+
svr.db["sb_users"] = users
135+
124136
fmt.Printf("%s http://localhost:%v\n", clsecondary("Server started at:"), port)
137+
fmt.Printf("%s: a@b.com with password test123\n", clsecondary("Your admin user is"))
125138
fmt.Println(http.ListenAndServe(":"+port, nil))
126139
}
127140

0 commit comments

Comments
 (0)