|
|
|
@ -186,7 +186,6 @@ func main() {
|
|
|
|
|
applicationStatus := initStatus(authorizeEndpointMgmt, flags)
|
|
|
|
|
|
|
|
|
|
if *flags.Endpoint != "" {
|
|
|
|
|
var endpoints []portainer.Endpoint
|
|
|
|
|
endpoints, err := store.EndpointService.Endpoints()
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
@ -229,7 +228,12 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if adminPasswordHash != "" {
|
|
|
|
|
users, err := store.UserService.UsersByRole(portainer.AdministratorRole)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(users) == 0 {
|
|
|
|
|
log.Printf("Creating admin user with password hash %s", adminPasswordHash)
|
|
|
|
|
user := &portainer.User{
|
|
|
|
|
Username: "admin",
|
|
|
|
@ -240,6 +244,9 @@ func main() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.Println("Instance already has an administrator user defined. Skipping admin password related flags.")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var server portainer.Server = &http.Server{
|
|
|
|
|