feat: add flags to disable WebDAV and Admin UI in weed mini (#7971)

* feat: add flags to disable WebDAV and Admin UI in weed mini

- Add -webdav flag (default: true) to optionally disable WebDAV server
- Add -admin.ui flag (default: true) to optionally disable Admin UI only (server still runs)
- Conditionally skip WebDAV service startup based on flag
- Pass disableUI flag to SetupRoutes to skip UI route registration
- Admin server still runs for gRPC and API access when UI is disabled

Addresses issue from https://github.com/seaweedfs/seaweedfs/pull/7833#issuecomment-3711924150

* refactor: use positive enableUI parameter instead of disableUI across admin server and handlers

* docs: update mini welcome message to list enabled components

* chore: remove unused welcomeMessageTemplate constant

* docs: split S3 credential message into separate sb.WriteString calls
This commit is contained in:
Chris Lu
2026-01-05 13:10:11 -08:00
committed by GitHub
parent 021d9fdab5
commit d15f32ae46
3 changed files with 64 additions and 47 deletions

View File

@@ -210,8 +210,8 @@ func runAdmin(cmd *Command, args []string) bool {
cancel()
}()
// Start the admin server with all masters
err := startAdminServer(ctx, a)
// Start the admin server with all masters (UI enabled by default)
err := startAdminServer(ctx, a, true)
if err != nil {
fmt.Printf("Admin server error: %v\n", err)
return false
@@ -222,7 +222,7 @@ func runAdmin(cmd *Command, args []string) bool {
}
// startAdminServer starts the actual admin server
func startAdminServer(ctx context.Context, options AdminOptions) error {
func startAdminServer(ctx context.Context, options AdminOptions, enableUI bool) error {
// Set Gin mode
gin.SetMode(gin.ReleaseMode)
@@ -307,7 +307,7 @@ func startAdminServer(ctx context.Context, options AdminOptions) error {
// Create handlers and setup routes
authRequired := *options.adminPassword != ""
adminHandlers := handlers.NewAdminHandlers(adminServer)
adminHandlers.SetupRoutes(r, authRequired, *options.adminUser, *options.adminPassword, *options.readOnlyUser, *options.readOnlyPassword)
adminHandlers.SetupRoutes(r, authRequired, *options.adminUser, *options.adminPassword, *options.readOnlyUser, *options.readOnlyPassword, enableUI)
// Server configuration
addr := fmt.Sprintf(":%d", *options.port)