mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 03:31:41 +00:00
Add -version flag (#1581)
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
This commit is contained in:
parent
b7e288084c
commit
cb41c992f7
@ -16,18 +16,28 @@ package setup
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/internal/config"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var configPath = flag.String("config", "dendrite.yaml", "The path to the config file. For more information, see the config file in this repository.")
|
||||
var (
|
||||
configPath = flag.String("config", "dendrite.yaml", "The path to the config file. For more information, see the config file in this repository.")
|
||||
version = flag.Bool("version", false, "Shows the current version and exits immediately.")
|
||||
)
|
||||
|
||||
// ParseFlags parses the commandline flags and uses them to create a config.
|
||||
func ParseFlags(monolith bool) *config.Dendrite {
|
||||
flag.Parse()
|
||||
|
||||
if *version {
|
||||
fmt.Println(internal.VersionString())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if *configPath == "" {
|
||||
logrus.Fatal("--config must be supplied")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user