网络层
This commit is contained in:
@@ -8,12 +8,22 @@ log:
|
||||
max_backups: 3
|
||||
max_age: 7
|
||||
|
||||
grpc:
|
||||
registry:
|
||||
db:
|
||||
etcd:
|
||||
address: [ "10.0.40.9:2379" ]
|
||||
|
||||
serve:
|
||||
grpc:
|
||||
address: "10.0.40.199"
|
||||
port: 8500
|
||||
ttl: 20
|
||||
|
||||
db:
|
||||
etcd:
|
||||
address: [ "10.0.40.9:2379" ]
|
||||
socket:
|
||||
web:
|
||||
address: "0.0.0.0"
|
||||
port: 8501
|
||||
raw:
|
||||
address: "0.0.0.0"
|
||||
port: 8502
|
||||
http:
|
||||
address: "0.0.0.0"
|
||||
port: 8503
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package config
|
||||
|
||||
type Config struct {
|
||||
App AppConfig `yaml:"app"`
|
||||
Log LogConfig `yaml:"log"`
|
||||
Grpc GrpcConfig `yaml:"grpc"`
|
||||
DB DBConfig `yaml:"db"`
|
||||
App *AppConfig `yaml:"app"`
|
||||
Log *LogConfig `yaml:"log"`
|
||||
DB *DBConfig `yaml:"db"`
|
||||
Serve *ServeConfig `yaml:"serve"`
|
||||
}
|
||||
|
||||
type AppConfig struct {
|
||||
@@ -19,16 +19,25 @@ type LogConfig struct {
|
||||
Level string `yaml:"level"`
|
||||
}
|
||||
|
||||
type GrpcConfig struct {
|
||||
Registry *struct {
|
||||
Address string `yaml:"address"`
|
||||
Port int `yaml:"port"`
|
||||
TTL int64 `yaml:"ttl"`
|
||||
} `yaml:"registry"`
|
||||
}
|
||||
|
||||
type DBConfig struct {
|
||||
Etcd *struct {
|
||||
Address []string `yaml:"address"`
|
||||
} `yaml:"etcd"`
|
||||
}
|
||||
|
||||
type ServeConfig struct {
|
||||
Grpc *struct {
|
||||
AddressConfig
|
||||
TTL int64 `yaml:"ttl"`
|
||||
} `yaml:"grpc"`
|
||||
Socket *struct {
|
||||
Web *AddressConfig `yaml:"web"`
|
||||
Raw *AddressConfig `yaml:"raw"`
|
||||
} `yaml:"socket"`
|
||||
Http *AddressConfig `yaml:"http"`
|
||||
}
|
||||
|
||||
type AddressConfig struct {
|
||||
Address string `yaml:"address"`
|
||||
Port int `yaml:"port"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user