mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 19:22:46 +08:00
conf
This commit is contained in:
parent
0547f25ecb
commit
4ac9943565
@ -22,6 +22,7 @@ const (
|
|||||||
NotificationFileName = "notification.yaml"
|
NotificationFileName = "notification.yaml"
|
||||||
ENV = "CONFIG_NAME"
|
ENV = "CONFIG_NAME"
|
||||||
DefaultPath = "../config/"
|
DefaultPath = "../config/"
|
||||||
|
ConfKey = "conf"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Config config
|
var Config config
|
||||||
@ -525,8 +526,16 @@ func (c *config) initConfig(config interface{}, configName, configPath string) e
|
|||||||
return c.unmarshalConfig(config, configPath)
|
return c.unmarshalConfig(config, configPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *config) Register(registry discoveryregistry.SvcDiscoveryRegistry) error {
|
func (c *config) RegisterConf2Registry(registry discoveryregistry.SvcDiscoveryRegistry) error {
|
||||||
registry
|
bytes, err := yaml.Marshal(Config)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return registry.RegisterConf2Registry(ConfKey, bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *config) GetConfFromRegistry(registry discoveryregistry.SvcDiscoveryRegistry) ([]byte, error) {
|
||||||
|
return registry.GetConfFromRegistry(ConfKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitConfig() error {
|
func InitConfig() error {
|
||||||
|
@ -9,5 +9,7 @@ type SvcDiscoveryRegistry interface {
|
|||||||
UnRegister() error
|
UnRegister() error
|
||||||
GetConns(serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error)
|
GetConns(serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error)
|
||||||
GetConn(serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
|
GetConn(serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
|
||||||
Re
|
|
||||||
|
RegisterConf2Registry(key string, conf []byte) error
|
||||||
|
GetConfFromRegistry(key string) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
6
pkg/utils/lock.go
Normal file
6
pkg/utils/lock.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
type DistributedLock interface {
|
||||||
|
Lock()
|
||||||
|
UnLock()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user