first commit
This commit is contained in:
42
models/config.go
Normal file
42
models/config.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"gitea.tecamino.com/paadi/tecamino-logger/logging"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
AllowOrigins []string
|
||||
Ip string
|
||||
Port int
|
||||
Log logging.Config
|
||||
PubSub PubSub
|
||||
}
|
||||
|
||||
type PubSub struct {
|
||||
Workers int
|
||||
MaxMessages int
|
||||
}
|
||||
|
||||
func (c *Config) Default() {
|
||||
if len(c.AllowOrigins) == 0 {
|
||||
c.AllowOrigins = []string{"*"}
|
||||
}
|
||||
if c.Ip == "" {
|
||||
c.Ip = "0.0.0.0"
|
||||
}
|
||||
if c.Log.MaxSize == 0 {
|
||||
c.Log.MaxSize = 3
|
||||
}
|
||||
if c.Log.MaxBackup == 0 {
|
||||
c.Log.MaxBackup = 3
|
||||
}
|
||||
if c.Log.MaxAge == 0 {
|
||||
c.Log.MaxAge = 30
|
||||
}
|
||||
if c.PubSub.Workers == 0 {
|
||||
c.PubSub.Workers = 5
|
||||
}
|
||||
if c.PubSub.MaxMessages == 0 {
|
||||
c.PubSub.MaxMessages = 256
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user