diff --git a/server/server.go b/server/server.go index bedf289..54fd97f 100644 --- a/server/server.go +++ b/server/server.go @@ -44,6 +44,17 @@ func NewServer(config *Config) (*UserServer, error) { srv.Handler = r srv.store = store.NewMemoryStore() + // Add initial admin-user + u := users.User{ + ID: uuid.Must(uuid.NewRandom()).String(), + Username: "admin", + } + password := uuid.Must(uuid.NewRandom()).String() + _ = u.SetPassword(password) + _ = srv.store.AddUser(u) + + srv.Logger.Warn("Initial admin-user created.", "username", u.Username, "password", password) + conn, err := nats.Connect(config.NATSAddr) if err != nil { return nil, err