43 lines
676 B
Go
43 lines
676 B
Go
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
|
|
}
|
|
}
|