Skip to content

Instantly share code, notes, and snippets.

@superdump
Created June 26, 2017 07:22
Show Gist options
  • Save superdump/b3f3441dfa162ebf91d54fea4d8b9cf1 to your computer and use it in GitHub Desktop.
Save superdump/b3f3441dfa162ebf91d54fea4d8b9cf1 to your computer and use it in GitHub Desktop.
// Copyright 2017 Vector Creations Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"os"
"text/template"
)
type Config struct {
ServerName string
BaseDir string
}
const CONFIG_TEMPLATE = `# The config file version format
version: v0
# The matrix specific config
matrix:
# The name of the server. This is usually the domain name, e.g 'matrix.org', 'localhost'.
server_name: "{{.ServerName}}"
# The path to the PEM formatted matrix private key.
private_key: "{{.BaseDir}}/matrix_key.pem"
# The x509 certificates used by the federation listeners for this server
federation_certificates: ["{{.BaseDir}}/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: {{.BaseDir}}/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: ["kafka: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://postgres/dendrite_account?sslmode=disable"
device: "postgres://postgres/dendrite_device?sslmode=disable"
media_api: "postgres://postgres/dendrite_media_api?sslmode=disable"
sync_api: "postgres://postgres/dendrite_sync_api?sslmode=disable"
room_server: "postgres://postgres/dendrite_room_server?sslmode=disable"
server_key: "postgres://postgres/dendrite_server_key?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: ":7770"
client_api: ":7771"
federation_api: ":7772"
sync_api: ":7773"
media_api: ":7774"
`
func main() {
t := template.New("config")
t, _ = t.Parse(CONFIG_TEMPLATE)
workingDir, _ := os.Getwd()
t.Execute(os.Stdout, Config{
ServerName: "localhost",
BaseDir: workingDir,
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment