changed type for core section.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -19,9 +19,9 @@ type ConfYaml struct {
|
||||
// SectionCore is sub seciont of config.
|
||||
type SectionCore struct {
|
||||
Port string `yaml:"port"`
|
||||
MaxNotification int `yaml:"max_notification"`
|
||||
WorkerNum int `yaml:"worker_num"`
|
||||
QueueNum int `yaml:"queue_num"`
|
||||
MaxNotification int64 `yaml:"max_notification"`
|
||||
WorkerNum int64 `yaml:"worker_num"`
|
||||
QueueNum int64 `yaml:"queue_num"`
|
||||
Mode string `yaml:"mode"`
|
||||
SSL bool `yaml:"ssl"`
|
||||
CertPath string `yaml:"cert_path"`
|
||||
@@ -102,13 +102,13 @@ func BuildDefaultPushConf() ConfYaml {
|
||||
|
||||
// Core
|
||||
conf.Core.Port = "8088"
|
||||
conf.Core.WorkerNum = runtime.NumCPU()
|
||||
conf.Core.QueueNum = 8192
|
||||
conf.Core.WorkerNum = int64(runtime.NumCPU())
|
||||
conf.Core.QueueNum = int64(8192)
|
||||
conf.Core.Mode = "release"
|
||||
conf.Core.SSL = false
|
||||
conf.Core.CertPath = "cert.pem"
|
||||
conf.Core.KeyPath = "key.pem"
|
||||
conf.Core.MaxNotification = 100
|
||||
conf.Core.MaxNotification = int64(100)
|
||||
conf.Core.HTTPProxy = ""
|
||||
conf.Core.PID.Enabled = false
|
||||
conf.Core.PID.Path = "gorush.pid"
|
||||
|
||||
@@ -55,13 +55,13 @@ func (suite *ConfigTestSuite) SetupTest() {
|
||||
func (suite *ConfigTestSuite) TestValidateConfDefault() {
|
||||
// Core
|
||||
assert.Equal(suite.T(), "8088", suite.ConfGorushDefault.Core.Port)
|
||||
assert.Equal(suite.T(), runtime.NumCPU(), suite.ConfGorushDefault.Core.WorkerNum)
|
||||
assert.Equal(suite.T(), 8192, suite.ConfGorushDefault.Core.QueueNum)
|
||||
assert.Equal(suite.T(), int64(runtime.NumCPU()), suite.ConfGorushDefault.Core.WorkerNum)
|
||||
assert.Equal(suite.T(), int64(8192), suite.ConfGorushDefault.Core.QueueNum)
|
||||
assert.Equal(suite.T(), "release", suite.ConfGorushDefault.Core.Mode)
|
||||
assert.Equal(suite.T(), false, suite.ConfGorushDefault.Core.SSL)
|
||||
assert.Equal(suite.T(), "cert.pem", suite.ConfGorushDefault.Core.CertPath)
|
||||
assert.Equal(suite.T(), "key.pem", suite.ConfGorushDefault.Core.KeyPath)
|
||||
assert.Equal(suite.T(), 100, suite.ConfGorushDefault.Core.MaxNotification)
|
||||
assert.Equal(suite.T(), int64(100), suite.ConfGorushDefault.Core.MaxNotification)
|
||||
assert.Equal(suite.T(), "", suite.ConfGorushDefault.Core.HTTPProxy)
|
||||
// Pid
|
||||
assert.Equal(suite.T(), false, suite.ConfGorushDefault.Core.PID.Enabled)
|
||||
@@ -107,13 +107,13 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() {
|
||||
func (suite *ConfigTestSuite) TestValidateConf() {
|
||||
// Core
|
||||
assert.Equal(suite.T(), "8088", suite.ConfGorush.Core.Port)
|
||||
assert.Equal(suite.T(), 8, suite.ConfGorush.Core.WorkerNum)
|
||||
assert.Equal(suite.T(), 8192, suite.ConfGorush.Core.QueueNum)
|
||||
assert.Equal(suite.T(), int64(8), suite.ConfGorush.Core.WorkerNum)
|
||||
assert.Equal(suite.T(), int64(8192), suite.ConfGorush.Core.QueueNum)
|
||||
assert.Equal(suite.T(), "release", suite.ConfGorush.Core.Mode)
|
||||
assert.Equal(suite.T(), false, suite.ConfGorush.Core.SSL)
|
||||
assert.Equal(suite.T(), "cert.pem", suite.ConfGorush.Core.CertPath)
|
||||
assert.Equal(suite.T(), "key.pem", suite.ConfGorush.Core.KeyPath)
|
||||
assert.Equal(suite.T(), 100, suite.ConfGorush.Core.MaxNotification)
|
||||
assert.Equal(suite.T(), int64(100), suite.ConfGorush.Core.MaxNotification)
|
||||
assert.Equal(suite.T(), "", suite.ConfGorush.Core.HTTPProxy)
|
||||
// Pid
|
||||
assert.Equal(suite.T(), false, suite.ConfGorush.Core.PID.Enabled)
|
||||
|
||||
Reference in New Issue
Block a user