2020-08-10 08:18:04 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-07-14 08:26:14 -05:00
|
|
|
"crypto/rand"
|
|
|
|
"encoding/hex"
|
2020-09-03 04:12:11 -05:00
|
|
|
"flag"
|
2020-08-10 08:18:04 -05:00
|
|
|
"fmt"
|
|
|
|
|
2020-12-02 11:41:00 -06:00
|
|
|
"github.com/matrix-org/dendrite/setup/config"
|
2021-03-08 07:19:02 -06:00
|
|
|
"golang.org/x/crypto/bcrypt"
|
2020-08-10 08:18:04 -05:00
|
|
|
"gopkg.in/yaml.v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-09-03 04:12:11 -05:00
|
|
|
defaultsForCI := flag.Bool("ci", false, "sane defaults for CI testing")
|
|
|
|
flag.Parse()
|
|
|
|
|
2020-08-10 08:18:04 -05:00
|
|
|
cfg := &config.Dendrite{}
|
|
|
|
cfg.Defaults()
|
2020-08-11 07:21:26 -05:00
|
|
|
cfg.Global.TrustedIDServers = []string{
|
|
|
|
"matrix.org",
|
|
|
|
"vector.im",
|
|
|
|
}
|
2020-08-10 08:18:04 -05:00
|
|
|
cfg.Logging = []config.LogrusHook{
|
|
|
|
{
|
|
|
|
Type: "file",
|
|
|
|
Level: "info",
|
|
|
|
Params: map[string]interface{}{
|
|
|
|
"path": "/var/log/dendrite",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2020-10-07 10:23:18 -05:00
|
|
|
cfg.SigningKeyServer.KeyPerspectives = config.KeyPerspectives{
|
2020-08-11 07:21:26 -05:00
|
|
|
{
|
|
|
|
ServerName: "matrix.org",
|
|
|
|
Keys: []config.KeyPerspectiveTrustKey{
|
|
|
|
{
|
|
|
|
KeyID: "ed25519:auto",
|
|
|
|
PublicKey: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
KeyID: "ed25519:a_RXGa",
|
|
|
|
PublicKey: "l8Hft5qXKn1vfHrg3p4+W8gELQVo8N13JkluMfmn2sQ",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
cfg.MediaAPI.ThumbnailSizes = []config.ThumbnailSize{
|
|
|
|
{
|
|
|
|
Width: 32,
|
|
|
|
Height: 32,
|
|
|
|
ResizeMethod: "crop",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Width: 96,
|
|
|
|
Height: 96,
|
|
|
|
ResizeMethod: "crop",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Width: 640,
|
|
|
|
Height: 480,
|
|
|
|
ResizeMethod: "scale",
|
|
|
|
},
|
|
|
|
}
|
2020-08-10 08:18:04 -05:00
|
|
|
|
2020-09-03 04:12:11 -05:00
|
|
|
if *defaultsForCI {
|
2021-03-05 04:40:27 -06:00
|
|
|
cfg.AppServiceAPI.DisableTLSValidation = true
|
2020-09-03 04:12:11 -05:00
|
|
|
cfg.ClientAPI.RateLimiting.Enabled = false
|
|
|
|
cfg.FederationSender.DisableTLSValidation = true
|
2021-01-22 10:08:47 -06:00
|
|
|
cfg.MSCs.MSCs = []string{"msc2836", "msc2946", "msc2444", "msc2753"}
|
2020-12-04 08:11:01 -06:00
|
|
|
cfg.Logging[0].Level = "trace"
|
2020-12-17 12:25:51 -06:00
|
|
|
// don't hit matrix.org when running tests!!!
|
|
|
|
cfg.SigningKeyServer.KeyPerspectives = config.KeyPerspectives{}
|
2021-03-08 07:19:02 -06:00
|
|
|
cfg.UserAPI.BCryptCost = bcrypt.MinCost
|
2021-07-14 08:26:14 -05:00
|
|
|
var id [8]byte
|
|
|
|
_, _ = rand.Read(id[:])
|
|
|
|
cfg.Global.JetStream.StoragePath = config.Path(hex.EncodeToString(id[:]))
|
2020-09-03 04:12:11 -05:00
|
|
|
}
|
|
|
|
|
2020-08-10 08:18:04 -05:00
|
|
|
j, err := yaml.Marshal(cfg)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(string(j))
|
|
|
|
}
|