You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
396 B
28 lines
396 B
package configcenter |
|
|
|
import ( |
|
"go-common/library/log" |
|
"go-common/library/conf" |
|
) |
|
|
|
var ( |
|
// Conf conf |
|
Client *conf.Client |
|
Version int |
|
) |
|
|
|
func InitConfigCenter() { |
|
var err error |
|
if Client, err = conf.New(); err != nil { |
|
panic(err) |
|
} |
|
|
|
// watch update and update Version |
|
Client.WatchAll() |
|
go func() { |
|
for range Client.Event() { |
|
log.Info("config reload") |
|
Version += 1 |
|
} |
|
}() |
|
} |