implemented various things

This commit is contained in:
2023-02-28 19:05:09 +01:00
parent 2a42cbb07a
commit 8e5f33c99b
12 changed files with 297 additions and 114 deletions

View File

@@ -32,6 +32,15 @@ type Config struct {
StorageDir string
Url string
DbFile string
// fiber settings, see:
// https://docs.gofiber.io/api/fiber/#config
Prefork bool
AppName string
BodyLimit int
V4only bool
V6only bool
Network string
}
func Getversion() string {
@@ -44,6 +53,10 @@ func Getversion() string {
return fmt.Sprintf("This is upd version %s", VERSION)
}
func (c *Config) GetVersion() string {
return VERSION
}
// post processing of options, if any
func (c *Config) ApplyDefaults() {
if len(c.Url) == 0 {
@@ -53,4 +66,17 @@ func (c *Config) ApplyDefaults() {
c.Url = "http://" + c.Listen
}
}
switch {
case c.V4only:
c.Network = "tcp4"
case c.V6only:
c.Network = "tcp6"
default:
if c.Prefork {
c.Network = "tcp4"
} else {
c.Network = "tcp" // dual stack
}
}
}