mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-23 06:41:56 -06:00
Try to sane default on jetstream base path
This commit is contained in:
parent
ec4e0302c0
commit
ee6bfe24f5
|
@ -1,8 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
|
@ -72,9 +70,6 @@ func main() {
|
|||
// don't hit matrix.org when running tests!!!
|
||||
cfg.SigningKeyServer.KeyPerspectives = config.KeyPerspectives{}
|
||||
cfg.UserAPI.BCryptCost = bcrypt.MinCost
|
||||
var id [8]byte
|
||||
_, _ = rand.Read(id[:])
|
||||
cfg.Global.JetStream.StoragePath = config.Path(hex.EncodeToString(id[:]))
|
||||
}
|
||||
|
||||
j, err := yaml.Marshal(cfg)
|
||||
|
|
|
@ -329,6 +329,7 @@ func (c *Dendrite) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
|||
}
|
||||
|
||||
func (c *Dendrite) Wiring() {
|
||||
c.Global.JetStream.Matrix = &c.Global
|
||||
c.ClientAPI.Matrix = &c.Global
|
||||
c.EDUServer.Matrix = &c.Global
|
||||
c.FederationAPI.Matrix = &c.Global
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package config
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type JetStream struct {
|
||||
Matrix *Global `yaml:"-"`
|
||||
|
||||
// Persistent directory to store JetStream streams in.
|
||||
StoragePath Path `yaml:"storage_path"`
|
||||
// A list of NATS addresses to connect to. If none are specified, an
|
||||
|
@ -22,7 +28,11 @@ func (c *JetStream) TopicFor(name string) string {
|
|||
func (c *JetStream) Defaults() {
|
||||
c.Addresses = []string{}
|
||||
c.TopicPrefix = "Dendrite"
|
||||
c.StoragePath = Path("./")
|
||||
reg, err := regexp.Compile(`[^a-zA-Z0-9\.]+`)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
c.StoragePath = Path("./" + reg.ReplaceAllString(string(c.Matrix.ServerName), ""))
|
||||
}
|
||||
|
||||
func (c *JetStream) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||
|
|
Loading…
Reference in a new issue