clearUp Useless
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
package conf
|
|
||||||
|
|
||||||
import "sync"
|
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
Name string
|
|
||||||
Hostname string
|
|
||||||
PSKPath string
|
|
||||||
PublicKeyPath string
|
|
||||||
PrivateKeyPath string
|
|
||||||
DHTEndpointPort int64
|
|
||||||
|
|
||||||
BootstrapAddress string
|
|
||||||
}
|
|
||||||
|
|
||||||
var instance *Config
|
|
||||||
var once sync.Once
|
|
||||||
|
|
||||||
func GetConfig() *Config {
|
|
||||||
once.Do(func() {
|
|
||||||
instance = &Config{}
|
|
||||||
})
|
|
||||||
return instance
|
|
||||||
}
|
|
||||||
9
main.go
9
main.go
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"oc-peer/conf"
|
|
||||||
"oc-peer/infrastructure"
|
"oc-peer/infrastructure"
|
||||||
_ "oc-peer/routers"
|
_ "oc-peer/routers"
|
||||||
|
|
||||||
@@ -28,14 +27,6 @@ func main() {
|
|||||||
o.GetStringDefault("LOKI_URL", ""),
|
o.GetStringDefault("LOKI_URL", ""),
|
||||||
o.GetStringDefault("LOG_LEVEL", "info"),
|
o.GetStringDefault("LOG_LEVEL", "info"),
|
||||||
)
|
)
|
||||||
conf.GetConfig().Name = o.GetStringDefault("NAME", "local")
|
|
||||||
conf.GetConfig().Hostname = o.GetStringDefault("HOSTNAME", "http://localhost")
|
|
||||||
conf.GetConfig().PSKPath = o.GetStringDefault("PSK_PATH", "./psk/psk")
|
|
||||||
conf.GetConfig().PublicKeyPath = o.GetStringDefault("PEER_PUBLIC_KEY_PATH", "./pem/public.pem")
|
|
||||||
conf.GetConfig().PrivateKeyPath = o.GetStringDefault("PEER_PRIVATE_KEY_PATH", "./pem/private.pem")
|
|
||||||
conf.GetConfig().DHTEndpointPort = o.GetInt64Default("DHT_ENDPOINT_PORT", 4001)
|
|
||||||
|
|
||||||
conf.GetConfig().BootstrapAddress = o.GetStringDefault("BOOTSTRAP_ADDRESS", "")
|
|
||||||
// Beego init
|
// Beego init
|
||||||
beego.BConfig.AppName = appname
|
beego.BConfig.AppName = appname
|
||||||
beego.BConfig.Listen.HTTPPort = o.GetIntDefault("port", 8080)
|
beego.BConfig.Listen.HTTPPort = o.GetIntDefault("port", 8080)
|
||||||
|
|||||||
Reference in New Issue
Block a user