mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 22:26:38 +08:00
feat(cmd): register all 5 domain plugins in newWaveletApp and fix all lint issues
This commit is contained in:
+15
-1
@@ -22,6 +22,11 @@ import (
|
||||
"github.com/Rain-kl/Wavelet/internal/platform/bootstrap"
|
||||
"github.com/Rain-kl/Wavelet/internal/router"
|
||||
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||
"github.com/Rain-kl/Wavelet/plugins/domain/admin"
|
||||
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control"
|
||||
"github.com/Rain-kl/Wavelet/plugins/domain/user"
|
||||
"github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||
"github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||
"github.com/Rain-kl/Wavelet/plugins/infra/logger"
|
||||
@@ -29,7 +34,7 @@ import (
|
||||
"github.com/hibiken/asynq"
|
||||
)
|
||||
|
||||
// newWaveletApp creates a core.App wired with Wavelet platform infrastructure and profile drivers.
|
||||
// newWaveletApp creates a core.App wired with Wavelet platform infrastructure, domain plugins, and profile drivers.
|
||||
//
|
||||
//nolint:contextcheck
|
||||
func newWaveletApp(profile core.Profile) *core.App {
|
||||
@@ -46,6 +51,15 @@ func newWaveletApp(profile core.Profile) *core.App {
|
||||
storage.New(),
|
||||
)
|
||||
|
||||
// Register domain plugins
|
||||
app.Use(
|
||||
auth.New(),
|
||||
user.New(),
|
||||
message_gateway.New(),
|
||||
risk_control.New(),
|
||||
admin.New(),
|
||||
)
|
||||
|
||||
// Bind Goose migration runner
|
||||
app.SetMigrationRunner(func(_ context.Context, _ []extpoints.MigrationEntry) error {
|
||||
runMigrations()
|
||||
|
||||
@@ -26,9 +26,9 @@ func TestNewWaveletAppProfiles(t *testing.T) {
|
||||
require.NotNil(t, app)
|
||||
assert.Equal(t, prof, app.Profile())
|
||||
|
||||
// Verify 4 infra plugins + 3 driver plugins registered
|
||||
// Verify 4 infra plugins + 5 domain plugins + 3 driver plugins registered
|
||||
plugins := app.Plugins()
|
||||
assert.Len(t, plugins, 7)
|
||||
assert.Len(t, plugins, 12)
|
||||
|
||||
// Verify each standard infra plugin is registered
|
||||
_, ok := app.Plugin("database")
|
||||
@@ -43,6 +43,22 @@ func TestNewWaveletAppProfiles(t *testing.T) {
|
||||
_, ok = app.Plugin("storage")
|
||||
assert.True(t, ok, "storage plugin missing")
|
||||
|
||||
// Verify domain plugins
|
||||
_, ok = app.Plugin("auth")
|
||||
assert.True(t, ok, "auth plugin missing")
|
||||
|
||||
_, ok = app.Plugin("user")
|
||||
assert.True(t, ok, "user plugin missing")
|
||||
|
||||
_, ok = app.Plugin("message_gateway")
|
||||
assert.True(t, ok, "message_gateway plugin missing")
|
||||
|
||||
_, ok = app.Plugin("risk_control")
|
||||
assert.True(t, ok, "risk_control plugin missing")
|
||||
|
||||
_, ok = app.Plugin("admin")
|
||||
assert.True(t, ok, "admin plugin missing")
|
||||
|
||||
// Verify driver plugins
|
||||
_, ok = app.Plugin("driver_wavelet_http")
|
||||
assert.True(t, ok, "http driver missing")
|
||||
|
||||
Reference in New Issue
Block a user