mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 05:42:46 +00:00
Merge branch 'master' into add-nats-support
This commit is contained in:
commit
e2e1a966e1
41 changed files with 959 additions and 714 deletions
|
@ -137,15 +137,14 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, useHTTPAPIs boo
|
|||
|
||||
var dnsCache *gomatrixserverlib.DNSCache
|
||||
if cfg.Global.DNSCache.Enabled {
|
||||
lifetime := time.Second * cfg.Global.DNSCache.CacheLifetime
|
||||
dnsCache = gomatrixserverlib.NewDNSCache(
|
||||
cfg.Global.DNSCache.CacheSize,
|
||||
lifetime,
|
||||
cfg.Global.DNSCache.CacheLifetime,
|
||||
)
|
||||
logrus.Infof(
|
||||
"DNS cache enabled (size %d, lifetime %s)",
|
||||
cfg.Global.DNSCache.CacheSize,
|
||||
lifetime,
|
||||
cfg.Global.DNSCache.CacheLifetime,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package config
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
type MediaAPI struct {
|
||||
|
@ -36,6 +35,9 @@ type MediaAPI struct {
|
|||
ThumbnailSizes []ThumbnailSize `yaml:"thumbnail_sizes"`
|
||||
}
|
||||
|
||||
// DefaultMaxFileSizeBytes defines the default file size allowed in transfers
|
||||
var DefaultMaxFileSizeBytes = FileSizeBytes(10485760)
|
||||
|
||||
func (c *MediaAPI) Defaults() {
|
||||
c.InternalAPI.Listen = "http://localhost:7774"
|
||||
c.InternalAPI.Connect = "http://localhost:7774"
|
||||
|
@ -43,8 +45,7 @@ func (c *MediaAPI) Defaults() {
|
|||
c.Database.Defaults(5)
|
||||
c.Database.ConnectionString = "file:mediaapi.db"
|
||||
|
||||
defaultMaxFileSizeBytes := FileSizeBytes(10485760)
|
||||
c.MaxFileSizeBytes = &defaultMaxFileSizeBytes
|
||||
c.MaxFileSizeBytes = &DefaultMaxFileSizeBytes
|
||||
c.MaxThumbnailGenerators = 10
|
||||
c.BasePath = "./media_store"
|
||||
}
|
||||
|
@ -58,11 +59,6 @@ func (c *MediaAPI) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
|||
checkNotEmpty(configErrs, "media_api.database.connection_string", string(c.Database.ConnectionString))
|
||||
|
||||
checkNotEmpty(configErrs, "media_api.base_path", string(c.BasePath))
|
||||
// allow "unlimited" file size
|
||||
if c.MaxFileSizeBytes != nil && *c.MaxFileSizeBytes <= 0 {
|
||||
unlimitedSize := FileSizeBytes(math.MaxInt64 - 1)
|
||||
c.MaxFileSizeBytes = &unlimitedSize
|
||||
}
|
||||
checkPositive(configErrs, "media_api.max_file_size_bytes", int64(*c.MaxFileSizeBytes))
|
||||
checkPositive(configErrs, "media_api.max_thumbnail_generators", int64(c.MaxThumbnailGenerators))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue