Latest hacks for js

This commit is contained in:
Kegan Dougal 2020-02-25 22:51:10 +00:00
parent bf6aa8cfd5
commit dacbae001d
4 changed files with 17 additions and 7 deletions

View file

@ -63,6 +63,7 @@ func generateKey() ed25519.PrivateKey {
func main() {
cfg := &config.Dendrite{}
cfg.SetDefaults()
cfg.Kafka.UseNaffka = true
cfg.Database.Account = "file:dendritejs_account.db"
cfg.Database.AppService = "file:dendritejs_appservice.db"
@ -80,6 +81,9 @@ func main() {
"matrix.org", "vector.im",
}
cfg.Matrix.PrivateKey = generateKey()
if err := cfg.Derive(); err != nil {
logrus.Fatalf("Failed to derive values from config: %s", err)
}
base := basecomponent.NewBaseDendrite(cfg, "Monolith")
defer base.Close() // nolint: errcheck

View file

@ -365,7 +365,7 @@ func loadConfig(
return nil, err
}
config.setDefaults()
config.SetDefaults()
if err = config.check(monolithic); err != nil {
return nil, err
@ -398,7 +398,7 @@ func loadConfig(
config.Media.AbsBasePath = Path(absPath(basePath, config.Media.BasePath))
// Generate data from config options
err = config.derive()
err = config.Derive()
if err != nil {
return nil, err
}
@ -406,9 +406,9 @@ func loadConfig(
return &config, nil
}
// derive generates data that is derived from various values provided in
// Derive generates data that is derived from various values provided in
// the config file.
func (config *Dendrite) derive() error {
func (config *Dendrite) Derive() error {
// Determine registrations flows based off config values
config.Derived.Registration.Params = make(map[string]interface{})
@ -433,8 +433,8 @@ func (config *Dendrite) derive() error {
return nil
}
// setDefaults sets default config values if they are not explicitly set.
func (config *Dendrite) setDefaults() {
// SetDefaults sets default config values if they are not explicitly set.
func (config *Dendrite) SetDefaults() {
if config.Matrix.KeyValidityPeriod == 0 {
config.Matrix.KeyValidityPeriod = 24 * time.Hour
}

2
go.mod
View file

@ -18,7 +18,7 @@ require (
github.com/lib/pq v1.2.0
github.com/matrix-org/dugong v0.0.0-20171220115018-ea0a4690a0d5
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200126031050-234d7bbbff9a
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225115056-c0aef2609ba2
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225224420-1ca1c9f64f82
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26
github.com/matrix-org/gomatrixserverlib v0.0.0-20200124100636-0c2ec91d1df5
github.com/matrix-org/naffka v0.0.0-20200127221512-0716baaabaf1

6
go.sum
View file

@ -75,6 +75,12 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20200225105839-089f29e7c4bd h1:pz266H
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225105839-089f29e7c4bd/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225115056-c0aef2609ba2 h1:ZgjpruDBBat81KC7Mv2dTc3nsLp5mNV/C6p637NQoqw=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225115056-c0aef2609ba2/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225214814-ffc26cc11c6c h1:anhIgTzzlpxfyMRg6zDu2ySXi6Rgm7OwjImULcb7fmU=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225214814-ffc26cc11c6c/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225220001-0b5561bfc12f h1:OOE9IBDB9DEp3cXs+bxnEagiuANedhOocpoWTv9BbKk=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225220001-0b5561bfc12f/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225224420-1ca1c9f64f82 h1:gFdtxNrSzfqVdMR/xGdactHjQBqb/eSPrrXwe/C/goE=
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225224420-1ca1c9f64f82/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/gomatrix v0.0.0-20190130130140-385f072fe9af h1:piaIBNQGIHnni27xRB7VKkEwoWCgAmeuYf8pxAyG0bI=
github.com/matrix-org/gomatrix v0.0.0-20190130130140-385f072fe9af/go.mod h1:3fxX6gUjWyI/2Bt7J1OLhpCzOfO/bB3AiX0cJtEKud0=
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26 h1:Hr3zjRsq2bhrnp3Ky1qgx/fzCtCALOoGYylh2tpS9K4=