mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
fix #2157
Embed a copy of the ergo default config in the binary; add `ergo defaultconfig` to print it to stdout
This commit is contained in:
parent
5ee32cda1c
commit
af521c844f
7
ergo.go
7
ergo.go
@ -7,6 +7,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -26,6 +27,9 @@ import (
|
|||||||
var commit = "" // git hash
|
var commit = "" // git hash
|
||||||
var version = "" // tagged version
|
var version = "" // tagged version
|
||||||
|
|
||||||
|
//go:embed default.yaml
|
||||||
|
var defaultConfig string
|
||||||
|
|
||||||
// get a password from stdin from the user
|
// get a password from stdin from the user
|
||||||
func getPasswordFromTerminal() string {
|
func getPasswordFromTerminal() string {
|
||||||
bytePassword, err := term.ReadPassword(int(syscall.Stdin))
|
bytePassword, err := term.ReadPassword(int(syscall.Stdin))
|
||||||
@ -94,6 +98,7 @@ Usage:
|
|||||||
ergo importdb <database.json> [--conf <filename>] [--quiet]
|
ergo importdb <database.json> [--conf <filename>] [--quiet]
|
||||||
ergo genpasswd [--conf <filename>] [--quiet]
|
ergo genpasswd [--conf <filename>] [--quiet]
|
||||||
ergo mkcerts [--conf <filename>] [--quiet]
|
ergo mkcerts [--conf <filename>] [--quiet]
|
||||||
|
ergo defaultconfig
|
||||||
ergo run [--conf <filename>] [--quiet] [--smoke]
|
ergo run [--conf <filename>] [--quiet] [--smoke]
|
||||||
ergo -h | --help
|
ergo -h | --help
|
||||||
ergo --version
|
ergo --version
|
||||||
@ -173,6 +178,8 @@ Options:
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error while importing db:", err.Error())
|
log.Fatal("Error while importing db:", err.Error())
|
||||||
}
|
}
|
||||||
|
} else if arguments["defaultconfig"].(bool) {
|
||||||
|
fmt.Print(defaultConfig)
|
||||||
} else if arguments["run"].(bool) {
|
} else if arguments["run"].(bool) {
|
||||||
if !arguments["--quiet"].(bool) {
|
if !arguments["--quiet"].(bool) {
|
||||||
logman.Info("server", fmt.Sprintf("%s starting", irc.Ver))
|
logman.Info("server", fmt.Sprintf("%s starting", irc.Ver))
|
||||||
|
Loading…
Reference in New Issue
Block a user