main, lib: Build in standalone etcd
Standalone etcd is useful for when we don't want to use the embedded version to make it easier to deploy somewhere or for testing. This pulls in about the same amount of code since we already embedded etcd previously. Since the embedded etcd feature of mgmt is not very stable, we'll add this for now.
This commit is contained in:
14
main.go
14
main.go
@@ -23,6 +23,7 @@ import (
|
||||
"os"
|
||||
|
||||
mgmt "github.com/purpleidea/mgmt/lib"
|
||||
"go.etcd.io/etcd/server/v3/etcdmain"
|
||||
)
|
||||
|
||||
// These constants are some global variables that are used throughout the code.
|
||||
@@ -41,6 +42,19 @@ var (
|
||||
var copying string
|
||||
|
||||
func main() {
|
||||
// embed etcd completely
|
||||
if len(os.Args) >= 2 && os.Args[1] == "etcd" {
|
||||
args := []string{}
|
||||
for i, s := range os.Args {
|
||||
if i == 0 { // pop off our argv[0] and let `etcd` be it
|
||||
continue
|
||||
}
|
||||
args = append(args, s)
|
||||
}
|
||||
etcdmain.Main(args) // this will os.Exit
|
||||
return // for safety
|
||||
}
|
||||
|
||||
flags := mgmt.Flags{
|
||||
Debug: Debug,
|
||||
Verbose: Verbose,
|
||||
|
||||
Reference in New Issue
Block a user