mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
parent
0f5603eca2
commit
4dcbc48159
16 changed files with 660 additions and 3 deletions
|
|
@ -723,6 +723,14 @@ type Config struct {
|
|||
} `yaml:"tagmsg-storage"`
|
||||
}
|
||||
|
||||
Metadata struct {
|
||||
// BeforeConnect int `yaml:"before-connect"` todo: this
|
||||
Enabled bool
|
||||
MaxSubs int `yaml:"max-subs"`
|
||||
MaxKeys int `yaml:"max-keys"`
|
||||
MaxValueBytes int `yaml:"max-value-length"` // todo: currently unenforced!!
|
||||
}
|
||||
|
||||
WebPush struct {
|
||||
Enabled bool
|
||||
Timeout time.Duration
|
||||
|
|
@ -1637,6 +1645,25 @@ func LoadConfig(filename string) (config *Config, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if !config.Metadata.Enabled {
|
||||
config.Server.supportedCaps.Disable(caps.Metadata)
|
||||
} else {
|
||||
var metadataValues []string
|
||||
if config.Metadata.MaxSubs >= 0 {
|
||||
metadataValues = append(metadataValues, fmt.Sprintf("max-subs=%d", config.Metadata.MaxSubs))
|
||||
}
|
||||
if config.Metadata.MaxKeys > 0 {
|
||||
metadataValues = append(metadataValues, fmt.Sprintf("max-keys=%d", config.Metadata.MaxKeys))
|
||||
}
|
||||
if config.Metadata.MaxValueBytes > 0 {
|
||||
metadataValues = append(metadataValues, fmt.Sprintf("max-value-bytes=%d", config.Metadata.MaxValueBytes))
|
||||
}
|
||||
if len(metadataValues) != 0 {
|
||||
config.Server.capValues[caps.Metadata] = strings.Join(metadataValues, ",")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
err = config.processExtjwt()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue