Add Port and MonitorPort to config
parent
0e97e4c3e1
commit
836d5af9e4
|
|
@ -7,17 +7,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const cdbpath = "DBPath"
|
const cdbpath = "DBPath"
|
||||||
|
const port = "port"
|
||||||
|
const mport = "mport"
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
DBPath string
|
DBPath string
|
||||||
|
Port string
|
||||||
|
MonitorPort string
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *Config {
|
func New() *Config {
|
||||||
lookups := make(map[string]*string)
|
lookups := make(map[string]*string)
|
||||||
add(cdbpath, "./db", lookups)
|
add(cdbpath, "./db", lookups)
|
||||||
|
add(port, "9101", lookups)
|
||||||
|
add(mport, "9102", lookups)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
return &Config{
|
return &Config{
|
||||||
DBPath: *lookups[cdbpath],
|
DBPath: *lookups[cdbpath],
|
||||||
|
Port: *lookups[port],
|
||||||
|
MonitorPort: *lookups[mport],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue