/
wire_gen.go
95 lines (88 loc) · 3.17 KB
/
wire_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package service
import (
"context"
"github.com/authgear/authgear-server/pkg/lib/audit"
"github.com/authgear/authgear-server/pkg/lib/config"
"github.com/authgear/authgear-server/pkg/lib/deps"
"github.com/authgear/authgear-server/pkg/lib/hook"
"github.com/authgear/authgear-server/pkg/lib/infra/db/auditdb"
"github.com/authgear/authgear-server/pkg/portal/model"
"github.com/authgear/authgear-server/pkg/util/clock"
"github.com/authgear/authgear-server/pkg/util/log"
)
// Injectors from wire.go:
func newAuditSink(ctx context.Context, app *model.App, auditDatabase *auditdb.WriteHandle, loggerFactory *log.Factory) *audit.Sink {
logger := audit.NewLogger(loggerFactory)
appContext := app.Context
config := appContext.Config
secretConfig := config.SecretConfig
auditDatabaseCredentials := deps.ProvideAuditDatabaseCredentials(secretConfig)
appConfig := config.AppConfig
appID := appConfig.ID
sqlBuilderApp := auditdb.NewSQLBuilderApp(auditDatabaseCredentials, appID)
writeSQLExecutor := auditdb.NewWriteSQLExecutor(ctx, auditDatabase)
writeStore := &audit.WriteStore{
SQLBuilder: sqlBuilderApp,
SQLExecutor: writeSQLExecutor,
}
sink := &audit.Sink{
Logger: logger,
Database: auditDatabase,
Store: writeStore,
}
return sink
}
func newHookSink(ctx context.Context, app *model.App, denoEndpoint config.DenoEndpoint, loggerFactory *log.Factory) *hook.Sink {
logger := hook.NewLogger(loggerFactory)
appContext := app.Context
configConfig := appContext.Config
appConfig := configConfig.AppConfig
hookConfig := appConfig.Hook
clock := _wireSystemClockValue
secretConfig := configConfig.SecretConfig
webhookKeyMaterials := deps.ProvideWebhookKeyMaterials(secretConfig)
webHookImpl := hook.WebHookImpl{
Secret: webhookKeyMaterials,
}
syncHTTPClient := hook.NewSyncHTTPClient(hookConfig)
asyncHTTPClient := hook.NewAsyncHTTPClient()
eventWebHookImpl := &hook.EventWebHookImpl{
WebHookImpl: webHookImpl,
SyncHTTP: syncHTTPClient,
AsyncHTTP: asyncHTTPClient,
}
manager := appContext.Resources
denoHook := hook.DenoHook{
Context: ctx,
ResourceManager: manager,
}
syncDenoClient := hook.NewSyncDenoClient(denoEndpoint, hookConfig, logger)
asyncDenoClient := hook.NewAsyncDenoClient(denoEndpoint, logger)
eventDenoHookImpl := &hook.EventDenoHookImpl{
DenoHook: denoHook,
SyncDenoClient: syncDenoClient,
AsyncDenoClient: asyncDenoClient,
}
noopAttributesService := _wireNoopAttributesServiceValue
noopRolesAndGroupsService := _wireNoopRolesAndGroupsServiceValue
sink := &hook.Sink{
Logger: logger,
Config: hookConfig,
Clock: clock,
EventWebHook: eventWebHookImpl,
EventDenoHook: eventDenoHookImpl,
StandardAttributes: noopAttributesService,
CustomAttributes: noopAttributesService,
RolesAndGroups: noopRolesAndGroupsService,
}
return sink
}
var (
_wireSystemClockValue = clock.NewSystemClock()
_wireNoopAttributesServiceValue = &NoopAttributesService{}
_wireNoopRolesAndGroupsServiceValue = &NoopRolesAndGroupsService{}
)