From b2f9b8c641dd3c1161695ac22944c1523c0cfd37 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 5 Jul 2017 13:10:28 +0100 Subject: [PATCH] Update the example configs with the new unified config (#146) * Update the example configs with the new unified config * Review comments * Use an int for the config version --- dendrite-config.yaml | 76 +++++++++++++++++++ media-api-server-config.yaml | 38 ---------- .../dendrite/common/config/config.go | 4 +- .../dendrite/common/config/config_test.go | 2 +- sync-server-config.yaml | 8 -- 5 files changed, 79 insertions(+), 49 deletions(-) create mode 100644 dendrite-config.yaml delete mode 100644 media-api-server-config.yaml delete mode 100644 sync-server-config.yaml diff --git a/dendrite-config.yaml b/dendrite-config.yaml new file mode 100644 index 000000000..0fc8e8baa --- /dev/null +++ b/dendrite-config.yaml @@ -0,0 +1,76 @@ +# The config file format version +# This is used by dendrite to tell if it understands the config format. +# This will change if the structure of the config file changes or if the meaning +# of an existing config key changes. +version: 0 + +# The matrix specific config +matrix: + # The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'. + server_name: "example.com" + # The path to the PEM formatted matrix private key. + private_key: "/etc/dendrite/matrix_key.pem" + # The x509 certificates used by the federation listeners for this server + federation_certificates: ["/etc/dendrite/federation_tls.pem"] + +# The media repository config +media: + # The base path to where the media files will be stored. May be relative or absolute. + base_path: /var/dendrite/media + + # The maximum file size in bytes that is allowed to be stored on this server. + # Note: if max_file_size_bytes is set to 0, the size is unlimited. + # Note: if max_file_size_bytes is not set, it will default to 10485760 (10MB) + max_file_size_bytes: 10485760 + + # Whether to dynamically generate thumbnails on-the-fly if the requested resolution is not already generated + # NOTE: This is a possible denial-of-service attack vector - use at your own risk + dynamic_thumbnails: false + + # A list of thumbnail sizes to be pre-generated for downloaded remote / uploaded content + # method is one of crop or scale. If omitted, it will default to scale. + # crop scales to fill the requested dimensions and crops the excess. + # scale scales to fit the requested dimensions and one dimension may be smaller than requested. + thumbnail_sizes: + - width: 32 + height: 32 + method: crop + - width: 96 + height: 96 + method: crop + - width: 320 + height: 240 + method: scale + - width: 640 + height: 480 + method: scale + - width: 800 + height: 600 + method: scale + +# The config for communicating with kafka +kafka: + # Where the kafka servers are running. + addresses: ["localhost:9092"] + # The names of the kafka topics to use. + topics: + input_room_event: roomserverInput + output_room_event: roomserverOutput + +# The postgres connection configs for connecting to the databases e.g a postgres:// URI +database: + account: "postgres://dendrite:itsasecret@localhost/dendrite_account?sslmode=disable" + device: "postgres://dendrite:itsasecret@localhost/dendrite_device?sslmode=disable" + media_api: "postgres://dendrite:itsasecret@localhost/dendrite_mediaapi?sslmode=disable" + sync_api: "postgres://dendrite:itsasecret@localhost/dendrite_syncapi?sslmode=disable" + room_server: "postgres://dendrite:itsasecret@localhost/dendrite_roomserver?sslmode=disable" + server_key: "postgres://dendrite:itsasecret@localhost/dendrite_serverkey?sslmode=disable" + +# The TCP host:port pairs to bind the internal HTTP APIs to. +# These shouldn't be exposed to the public internet. +listen: + room_server: "localhost:7770" + client_api: "localhost:7771" + federation_api: "localhost:7772" + sync_api: "localhost:7773" + media_api: "localhost:7774" diff --git a/media-api-server-config.yaml b/media-api-server-config.yaml deleted file mode 100644 index c222fe8fb..000000000 --- a/media-api-server-config.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'. -server_name: "example.com" - -# The base path to where the media files will be stored. May be relative or absolute. -base_path: /var/dendrite/media - -# The maximum file size in bytes that is allowed to be stored on this server. -# Note: if max_file_size_bytes is set to 0, the size is unlimited. -# Note: if max_file_size_bytes is not set, it will default to 10485760 (10MB) -max_file_size_bytes: 10485760 - -# The postgres connection config for connecting to the database e.g a postgres:// URI -database: "postgres://dendrite:itsasecret@localhost/mediaapi?sslmode=disable" - -# Whether to dynamically generate thumbnails on-the-fly if the requested resolution is not already generated -# NOTE: This is a possible denial-of-service attack vector - use at your own risk -dynamic_thumbnails: false - -# A list of thumbnail sizes to be pre-generated for downloaded remote / uploaded content -# method is one of crop or scale. If omitted, it will default to scale. -# crop scales to fill the requested dimensions and crops the excess. -# scale scales to fit the requested dimensions and one dimension may be smaller than requested. -thumbnail_sizes: -- width: 32 - height: 32 - method: crop -- width: 96 - height: 96 - method: crop -- width: 320 - height: 240 - method: scale -- width: 640 - height: 480 - method: scale -- width: 800 - height: 600 - method: scale diff --git a/src/github.com/matrix-org/dendrite/common/config/config.go b/src/github.com/matrix-org/dendrite/common/config/config.go index 58980ca3e..9a5a3dcc9 100644 --- a/src/github.com/matrix-org/dendrite/common/config/config.go +++ b/src/github.com/matrix-org/dendrite/common/config/config.go @@ -30,7 +30,7 @@ import ( // Version is the current version of the config format. // This will change whenever we make breaking changes to the config format. -const Version = "v0" +const Version = 0 // Dendrite contains all the config used by a dendrite process. // Relative paths are resolved relative to the current working directory @@ -41,7 +41,7 @@ type Dendrite struct { // to update their config file to the current version. // The version of the file should only be different if there has // been a breaking change to the config file format. - Version string `yaml:"version"` + Version int `yaml:"version"` // The configuration required for a matrix server. Matrix struct { diff --git a/src/github.com/matrix-org/dendrite/common/config/config_test.go b/src/github.com/matrix-org/dendrite/common/config/config_test.go index f690882ef..7af619688 100644 --- a/src/github.com/matrix-org/dendrite/common/config/config_test.go +++ b/src/github.com/matrix-org/dendrite/common/config/config_test.go @@ -32,7 +32,7 @@ func TestLoadConfigRelative(t *testing.T) { } const testConfig = ` -version: v0 +version: 0 matrix: server_name: localhost private_key: matrix_key.pem diff --git a/sync-server-config.yaml b/sync-server-config.yaml deleted file mode 100644 index cbe452b35..000000000 --- a/sync-server-config.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# A list of URIs which host Kafka logs. -consumer_uris: ["localhost:9092"] - -# The name of the topic which the sync server will consume events from. -roomserver_topic: "roomserverOutput" - -# The database URI to store sync server information. -database: "postgres://dendrite:itsasecret@localhost/syncserver?sslmode=disable"