aboutsummaryrefslogtreecommitdiff
path: root/cmd/generate-config/main.go
blob: e65723e6558589b7589a224f0665445c9ad2bb25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package main

import (
	"flag"
	"fmt"

	"github.com/matrix-org/dendrite/internal/config"
	"gopkg.in/yaml.v2"
)

func main() {
	defaultsForCI := flag.Bool("ci", false, "sane defaults for CI testing")
	flag.Parse()

	cfg := &config.Dendrite{}
	cfg.Defaults()
	cfg.Global.TrustedIDServers = []string{
		"matrix.org",
		"vector.im",
	}
	cfg.Logging = []config.LogrusHook{
		{
			Type:  "file",
			Level: "info",
			Params: map[string]interface{}{
				"path": "/var/log/dendrite",
			},
		},
	}
	cfg.SigningKeyServer.KeyPerspectives = config.KeyPerspectives{
		{
			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",
		},
	}

	if *defaultsForCI {
		cfg.ClientAPI.RateLimiting.Enabled = false
		cfg.FederationSender.DisableTLSValidation = true
	}

	j, err := yaml.Marshal(cfg)
	if err != nil {
		panic(err)
	}

	fmt.Println(string(j))
}