mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 06:36:38 +08:00
530a9dd3ee
BREAKING: pkg/migrator/ deleted entirely. Migration SQL files are now owned by each plugin in its own migrations/ directory. Architecture: - Delete pkg/migrator/ (26 global SQL files + ClickHouse migration) - Move global SQL to per-plugin migrations/ with go:embed + Register() - Rewrite cmd/app.go gooseEngine: uses Inject[DBService] for DB, iterates all plugin-registered MigrationEntry, runs goose.Up per entry - core.MigrationEngine.Migrate signature changed: *Context instead of context.Context, so engine can resolve services via IoC Per-plugin migration ownership: auth/ → w_access_tokens, w_auth_sources, w_external_accounts user/ → w_users (seed system user) admin/ → w_system_configs, w_templates (seeds) upload/ → w_uploads, w_upload_stats message_gateway/ → w_push_*, w_message_* risk_control/ → w_user_access_logs (PG + ClickHouse) driver_asynq_cron/ → w_schedules driver_asynq_worker/ → w_task_executions Dependencies: - cmd/banner.go: removed migration report display (migrations are automatic) - cmd/reset_passwd.go: removed PreRun migrator.Migrate() call - go.mod: clickhouse-go kept (used by plugins/infra/database/clickhouse.go)
55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Package cmd provides CLI command entry points.
|
|
//
|
|
//nolint:unused
|
|
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"runtime"
|
|
"strings"
|
|
|
|
"github.com/Rain-kl/Wavelet/pkg/buildinfo"
|
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
|
)
|
|
|
|
//nolint:unused // startup banner formatting utilities
|
|
type startupState struct {
|
|
mode string
|
|
listensForHTTP bool
|
|
}
|
|
|
|
func printStartupBanner(state startupState) {
|
|
log.Print(formatStartupBanner(state))
|
|
}
|
|
|
|
func formatStartupBanner(state startupState) string {
|
|
lines := []string{
|
|
"",
|
|
"__ __ _ _ ",
|
|
"\\ \\ / /_ ___ _____ | | ___| |_ ",
|
|
" \\ \\ /\\ / / _` \\ \\ / / _ \\ | |/ _ \\ __|",
|
|
" \\ V V / (_| |\\ V / __/ | | __/ |_ ",
|
|
" \\_/\\_/ \\__,_| \\_/ \\___|_|\\___|\\__|",
|
|
fmt.Sprintf(" Wavelet %s", buildinfo.Version),
|
|
"",
|
|
fmt.Sprintf(" Environment: %s", config.Config.App.Env),
|
|
fmt.Sprintf(" Runtime: %s/%s (%s)", runtime.GOOS, runtime.GOARCH, runtime.Version()),
|
|
fmt.Sprintf(" Build time: %s", buildTime()),
|
|
}
|
|
if state.listensForHTTP {
|
|
lines = append(lines, fmt.Sprintf(" Listening: http://%s", config.Config.App.Addr))
|
|
}
|
|
lines = append(lines, fmt.Sprintf(" Mode: %s", state.mode), "")
|
|
return strings.Join(lines, "\n")
|
|
}
|
|
|
|
func buildTime() string {
|
|
if buildinfo.BuildTime == "" {
|
|
return "development build"
|
|
}
|
|
return buildinfo.BuildTime
|
|
} |