config test

This commit is contained in:
geek 2018-04-09 21:55:27 +09:00
parent 1b3bd11200
commit 0a70f33d5f
3 changed files with 38 additions and 76 deletions

View File

@ -1,67 +1,16 @@
{
"server": {
"serverHandler": {
"name": "Gateway WebApp",
"network": "tcp4",
"addr": "192.168.1.103:19090",
"tls": false,
"concurrency": 262144,
"maxStopWaitTime": 0
},
"auth": {
"signingKey": "tWB0lUXiCwX4U3qsJZcZ10mKvEH793RHkTJDbDuZVshQTk4uNB6ck59UQ96lhsRi4XNUiEnlIbP8XYQMPabeNtERX3iyHeDcwocgUVAor1nkAajYeq1gNyJszGpMhEOT"
},
"websocket": {
"handshakeTimeout": 0,
"readBufferSize": 8192,
"writeBufferSize": 8192,
"maxMessageSize": 8192,
"readBufferSize": 1024,
"writeBufferSize": 1024,
"readTimeout": 0,
"writeTimeout": 0,
"pongTimeout": 60,
"pingTimeout": 10,
"pingPeriod": 10,
"enableCompression": false
},
"gRPC": {
"addr": "192.168.1.50:50006",
"tls": false,
"pool": {
"maxIdle": 1,
"maxCapacity": 3,
"idleTimeout": 240,
"wait": false
}
},
"redis": {
"network": "tcp",
"addr": "192.168.1.50:6379",
"tls": false,
"pool": {
"maxIdle": 1,
"maxCapacity": 3,
"idleTimeout": 240,
"wait": false
}
},
"servlets": {
"webapp": {
"entry": "/webapp",
"socket": {
"maxMessageSize": 8192,
"writeTimeout": 0,
"readTimeout": 0,
"pongTimeout": 60,
"pingTimeout": 10,
"pingPeriod": 10,
"binaryMessage": false
}
},
"file": {
"entry": "/file",
"socket": {
"maxMessageSize": 8192,
"writeTimeout": 0,
"readTimeout": 0,
"pongTimeout": 60,
"pingTimeout": 10,
"pingPeriod": 10,
"binaryMessage": false
}
}
}
}

9
config/config.go Normal file
View File

@ -0,0 +1,9 @@
package config
import (
"git.loafle.net/commons/server-go/socket/web"
)
type Config struct {
ServerHandler web.ServerHandlers `json:"serverHandler"`
}

36
main.go
View File

@ -1,8 +1,6 @@
package main
import (
//"flag"
//oocc "git.loafle.net/commons/configuration-go"
"git.loafle.net/commons/logging-go"
"git.loafle.net/overflow/member_gateway_rpc/server"
"log"
@ -11,26 +9,32 @@ import (
"syscall"
"time"
"context"
"flag"
"git.loafle.net/overflow/member_gateway_rpc/config"
"git.loafle.net/commons/configuration-go"
)
var (
configDir *string
)
//
//func init() {
// configDir = oocc.FlagConfigDir("./")
// logConfigPath = oocc.FlagLogConfigFilePath("")
// flag.Parse()
//
// logging.InitializeLogger(*logConfigPath)
//
// cc.SetConfigPath(*configDir)
// if err := cc.Load(&oogwc.Config, oocc.ConfigFileName); nil != err {
// logging.Logger().Panic(err)
// }
//}
func init() {
logging.InitializeLogger("")
configDir = flag.String("config-dir", "./", "Config directory")
logConfigPath := flag.String("log-config", "", "logging config path")
flag.Parse()
logging.InitializeLogger(*logConfigPath)
}
func main() {
config := &config.Config{}
configuration.SetConfigPath(*configDir)
if err := configuration.Load(config, "config.json"); nil != err {
logging.Logger().Panic(err)
}
s := server.New()
go func() {