feat 初次提交
This commit is contained in:
17
config/config.dev.yaml
Normal file
17
config/config.dev.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
app:
|
||||
name: "robot-dev"
|
||||
|
||||
log:
|
||||
debug: true
|
||||
level: "debug"
|
||||
maxSize: 10
|
||||
maxBackups: 100
|
||||
maxAge: 7
|
||||
|
||||
client:
|
||||
count: 1100
|
||||
usn: [ 1,1000000 ]
|
||||
websocket:
|
||||
# address: "ws://47.108.184.184/ws/"
|
||||
address: "ws://127.0.0.1"
|
||||
port: 8501
|
||||
28
config/config.go
Normal file
28
config/config.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package config
|
||||
|
||||
import "common/config"
|
||||
|
||||
const path = "./config"
|
||||
|
||||
type Config struct {
|
||||
App *config.AppConfig `yaml:"app"`
|
||||
Log *config.LogConfig `yaml:"log"`
|
||||
Client *struct {
|
||||
Count int32 `yaml:"count"`
|
||||
USN []int64 `yaml:"usn"`
|
||||
Websocket *config.AddressConfig `yaml:"websocket"`
|
||||
} `yaml:"client"`
|
||||
}
|
||||
|
||||
var cfg *Config
|
||||
|
||||
// LoadConfig 加载应用配置
|
||||
func LoadConfig() error {
|
||||
c, err := config.LoadConfig(path, cfg)
|
||||
cfg = c
|
||||
return err
|
||||
}
|
||||
|
||||
func Get() *Config {
|
||||
return cfg
|
||||
}
|
||||
16
config/config.prod.yaml
Normal file
16
config/config.prod.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
app:
|
||||
name: "robot-prod"
|
||||
|
||||
log:
|
||||
debug: false
|
||||
level: "debug"
|
||||
maxSize: 10
|
||||
maxBackups: 100
|
||||
maxAge: 7
|
||||
|
||||
client:
|
||||
count: 100
|
||||
usn: [ 1,1000000 ]
|
||||
websocket:
|
||||
address: "ws://172.18.28.0"
|
||||
port: 8501
|
||||
Reference in New Issue
Block a user