feat: add config-driven super-admin bootstrap to Go backend
This commit is contained in:
1 parent
8affa4b25a
commit
ff055c972d
5 files changed
+345
No files matched your search
@@ -3,6 +3,8 @@ package application
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -176,6 +178,11 @@ func New(options Options) (*App, error) {
|
||||
})
|
||||
|
||||
administrationService := administration.NewService(administrationStore)
|
||||
if created, err := BootstrapSuperAdmin(ctx, config.Backend, administrationService, ParseBootstrapAdminConfig(getenv)); err != nil {
|
||||
return nil, fmt.Errorf("bootstrap super administrator: %w", err)
|
||||
} else if created {
|
||||
log.Printf("zhinian-api bootstrapped the first super administrator from ZHINIAN_BOOTSTRAP_ADMIN_* configuration")
|
||||
}
|
||||
adminHandler, err := httpapi.NewAdminHandler(platformAuthorizer, administrationService)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user