54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package config
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gosvc"
|
|
"gosvc/httpserver"
|
|
"gosvc/logger"
|
|
)
|
|
|
|
func SetupServiceConfig() {
|
|
gosvc.Config = gosvc.ServiceConfig{
|
|
Name: "robotfs",
|
|
Version: gosvc.Config.Version,
|
|
Runtime: gosvc.RuntimeConfig{
|
|
RootOnly: false,
|
|
},
|
|
Logger: gosvc.LoggerConfig{
|
|
Options: logger.Options{
|
|
TargetDirectory: "/var/log/robotfs",
|
|
FilePrefix: "robotfs",
|
|
CycleFiles: 16,
|
|
MaxFileSize: 64 * 1024 * 1024,
|
|
},
|
|
},
|
|
Ticker: gosvc.TickerConfig{
|
|
Enable: false,
|
|
TickInterval: 1300 * time.Millisecond,
|
|
TickMinInterval: 300 * time.Millisecond,
|
|
TickOnStop: true,
|
|
},
|
|
Saver: gosvc.SaverConfig{
|
|
Enable: false,
|
|
SaveInterval: 60 * time.Second,
|
|
SaveMinInterval: 500 * time.Millisecond,
|
|
},
|
|
HTTPServer: gosvc.HTTPServerConfig{
|
|
Enable: true,
|
|
Options: httpserver.Options{
|
|
Address: "0.0.0.0:6201",
|
|
TLSEnabled: false,
|
|
CrossOriginEnabled: true,
|
|
MaxConcurrentStreams: 10000,
|
|
MaxTraces: 30 * 10000,
|
|
LogSlowRequest: true,
|
|
SlowRequestThreshold: 1000 * time.Millisecond,
|
|
},
|
|
},
|
|
}
|
|
|
|
gosvc.Config.HTTPServer.MaxRequestsPerSecond = 4000
|
|
gosvc.Config.HTTPServer.MaxPendingRequests = 15000
|
|
}
|