From 2ae7e40cf38f47109f92f91ab4bc4329405c4ab3 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Fri, 21 Apr 2017 14:03:24 +0200 Subject: [PATCH] cmd/dendrite: Add first shot at new single-binary CLI usage --- .../matrix-org/dendrite/cmd/dendrite/main.go | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/github.com/matrix-org/dendrite/cmd/dendrite/main.go diff --git a/src/github.com/matrix-org/dendrite/cmd/dendrite/main.go b/src/github.com/matrix-org/dendrite/cmd/dendrite/main.go new file mode 100644 index 000000000..d6a09f7c0 --- /dev/null +++ b/src/github.com/matrix-org/dendrite/cmd/dendrite/main.go @@ -0,0 +1,69 @@ +// 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 ( + "fmt" + + "github.com/docopt/docopt-go" +) + +func main() { + usage := ` +Usage: + dendrite serve all [options] + dendrite serve [options] + dendrite -V + dendrite -h + +Arguments: + One of: client-api, room-server, sync-api. + +Options: + -c , --config-file= + Path to a YAML-format configuration file. + -H , --host= + Host to bind. The port is optional and ignored for 'serve all'. The + default ports are: 7776 (sync-api), 7777 (room-server), and 7778 (client-api) + [default: "localhost"] + -h, --help + Print this usage text. + -k , --kafka-hosts= + A comma-separated list of Kafka hosts. [default: "localhost:9092"] + -l , --log-dir= + Path to log directory. If not set, logs will only be written to stderr. + -r , --room-server-host= + Host of the room server. [default: "localhost:7777"] + -t , --topic-prefix= + Prefix for Kafka topics used for inter-component communication. + [default: ""] + -V, --version + Print the dendrite version. + +Environment Variables: + PostgreSQL MUST be configured using the standard libpq environment variables: + https://www.postgresql.org/docs/current/static/libpq-envars.html + Required: + PGPASSWORD + PGHOST + Optional: + PGUSER Defaults to "postgres" + PGSSLMODE Defaults to "disabled" +` + + arguments, _ := docopt.Parse(usage, nil, true, + "dendrite Matrix homeserver, version 0.0.1", false) + fmt.Println(arguments) +}