Config tweaks, make random jetstream storage path for CI
This commit is contained in:
parent
be60a3bda4
commit
74735e7cd5
|
@ -1,6 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/hex"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
@ -70,6 +72,9 @@ func main() {
|
||||||
// don't hit matrix.org when running tests!!!
|
// don't hit matrix.org when running tests!!!
|
||||||
cfg.SigningKeyServer.KeyPerspectives = config.KeyPerspectives{}
|
cfg.SigningKeyServer.KeyPerspectives = config.KeyPerspectives{}
|
||||||
cfg.UserAPI.BCryptCost = bcrypt.MinCost
|
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)
|
j, err := yaml.Marshal(cfg)
|
||||||
|
|
|
@ -329,7 +329,6 @@ func (c *Dendrite) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Dendrite) Wiring() {
|
func (c *Dendrite) Wiring() {
|
||||||
c.Global.JetStream.Matrix = &c.Global
|
|
||||||
c.ClientAPI.Matrix = &c.Global
|
c.ClientAPI.Matrix = &c.Global
|
||||||
c.EDUServer.Matrix = &c.Global
|
c.EDUServer.Matrix = &c.Global
|
||||||
c.FederationAPI.Matrix = &c.Global
|
c.FederationAPI.Matrix = &c.Global
|
||||||
|
|
|
@ -3,8 +3,6 @@ package config
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
type JetStream struct {
|
type JetStream struct {
|
||||||
Matrix *Global `yaml:"-"`
|
|
||||||
|
|
||||||
// Persistent directory to store JetStream streams in.
|
// Persistent directory to store JetStream streams in.
|
||||||
StoragePath Path `yaml:"storage_path"`
|
StoragePath Path `yaml:"storage_path"`
|
||||||
// A list of NATS addresses to connect to. If none are specified, an
|
// A list of NATS addresses to connect to. If none are specified, an
|
||||||
|
@ -24,7 +22,7 @@ func (c *JetStream) TopicFor(name string) string {
|
||||||
func (c *JetStream) Defaults() {
|
func (c *JetStream) Defaults() {
|
||||||
c.Addresses = []string{}
|
c.Addresses = []string{}
|
||||||
c.TopicPrefix = "Dendrite"
|
c.TopicPrefix = "Dendrite"
|
||||||
c.StoragePath = Path(fmt.Sprintf("./%s", c.Matrix.ServerName))
|
c.StoragePath = Path("./")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *JetStream) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
func (c *JetStream) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||||
|
|
|
@ -24,10 +24,12 @@ func SetupConsumerProducer(cfg *config.JetStream) (sarama.Consumer, sarama.SyncP
|
||||||
if s == nil {
|
if s == nil {
|
||||||
var err error
|
var err error
|
||||||
natsServer, err = natsserver.NewServer(&natsserver.Options{
|
natsServer, err = natsserver.NewServer(&natsserver.Options{
|
||||||
ServerName: "monolith",
|
ServerName: "monolith",
|
||||||
DontListen: true,
|
DontListen: true,
|
||||||
JetStream: true,
|
JetStream: true,
|
||||||
StoreDir: string(cfg.Matrix.JetStream.StoragePath),
|
StoreDir: string(cfg.StoragePath),
|
||||||
|
NoSystemAccount: true,
|
||||||
|
AllowNewAccounts: false,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in a new issue