-
Notifications
You must be signed in to change notification settings - Fork 316
/
setup.go
31 lines (27 loc) · 876 Bytes
/
setup.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
package event_schema
import (
"strings"
"sync"
"github.com/rudderlabs/rudder-go-kit/config"
"github.com/rudderlabs/rudder-server/app"
"github.com/rudderlabs/rudder-server/utils/types"
)
var (
eventSchemaManager types.EventSchemasI
eventSchemaManagerLock sync.RWMutex
)
// GetInstance returns an instance of EventSchemaManagerT
func GetInstance() types.EventSchemasI {
pkgLogger.Info("[[ EventSchemas ]] Setting up EventSchemas FeatureValue")
eventSchemaManagerLock.Lock()
defer eventSchemaManagerLock.Unlock()
if eventSchemaManager == nil {
appTypeStr := strings.ToUpper(config.GetString("APP_TYPE", app.EMBEDDED))
schemaManager := getEventSchemaManager(
createDBConnection(),
appTypeStr == app.GATEWAY)
schemaManager.Setup() // Kickoff the corresponding supporting services.
eventSchemaManager = schemaManager
}
return eventSchemaManager
}