first commit

This commit is contained in:
Adrian Zuercher
2025-08-23 22:22:22 +02:00
commit e36d393749
14 changed files with 1555 additions and 0 deletions

42
models/config.go Normal file
View 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
}
}