From af521c844f0c5dd1fdafd096ee1dd3f6d97aba65 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Mon, 27 May 2024 23:08:11 -0400 Subject: [PATCH] fix #2157 Embed a copy of the ergo default config in the binary; add `ergo defaultconfig` to print it to stdout --- ergo.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ergo.go b/ergo.go index 7aa86f2e..ada69f7f 100644 --- a/ergo.go +++ b/ergo.go @@ -7,6 +7,7 @@ package main import ( "bufio" + _ "embed" "fmt" "log" "os" @@ -26,6 +27,9 @@ import ( var commit = "" // git hash var version = "" // tagged version +//go:embed default.yaml +var defaultConfig string + // get a password from stdin from the user func getPasswordFromTerminal() string { bytePassword, err := term.ReadPassword(int(syscall.Stdin)) @@ -94,6 +98,7 @@ Usage: ergo importdb [--conf ] [--quiet] ergo genpasswd [--conf ] [--quiet] ergo mkcerts [--conf ] [--quiet] + ergo defaultconfig ergo run [--conf ] [--quiet] [--smoke] ergo -h | --help ergo --version @@ -173,6 +178,8 @@ Options: if err != nil { log.Fatal("Error while importing db:", err.Error()) } + } else if arguments["defaultconfig"].(bool) { + fmt.Print(defaultConfig) } else if arguments["run"].(bool) { if !arguments["--quiet"].(bool) { logman.Info("server", fmt.Sprintf("%s starting", irc.Ver))