forked from apolloconfig/agollo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.go
42 lines (31 loc) · 856 Bytes
/
start.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
package agollo
//start apollo
func Start() {
//first sync
notifySyncConfigServices()
//start auto refresh config
go StartRefreshConfig(&AutoRefreshConfigComponent{})
//start long poll sync config
go StartRefreshConfig(&NotifyConfigComponent{})
}
func StartWithConfig(config *AppConfig) {
//init common
initCommon()
appConfig = config
//init config
go func(appConfig *AppConfig) {
apolloConfig := &ApolloConfig{}
apolloConfig.AppId = appConfig.AppId
apolloConfig.Cluster = appConfig.Cluster
apolloConfig.NamespaceName = appConfig.NamespaceName
updateApolloConfig(apolloConfig)
}(config)
// notify init
initNotify()
//first sync
notifySyncConfigServices()
//start auto refresh config
go StartRefreshConfig(&AutoRefreshConfigComponent{})
//start long poll sync config
go StartRefreshConfig(&NotifyConfigComponent{})
}