Skip to content

Commit 47b8042

Browse files
committed
Introduce command line option.
1 parent c5e8499 commit 47b8042

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

main.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,23 @@ import (
5454
// Configuration data with defaults:
5555

5656
const (
57-
projectName = "arangodb"
58-
logFileName = projectName + ".log"
59-
defaultDockerGCDelay = time.Minute * 10
60-
defaultDockerStarterImage = "arangodb/arangodb-starter"
61-
defaultArangodPath = "/usr/sbin/arangod"
62-
defaultArangoSyncPath = "/usr/sbin/arangosync"
63-
defaultLogRotateFilesToKeep = 5
64-
defaultLogRotateInterval = time.Minute * 60 * 24
57+
projectName = "arangodb"
58+
logFileName = projectName + ".log"
59+
defaultDockerGCDelay = time.Minute * 10
60+
defaultDockerStarterImage = "arangodb/arangodb-starter"
61+
defaultArangodPath = "/usr/sbin/arangod"
62+
defaultArangoSyncPath = "/usr/sbin/arangosync"
63+
defaultLogRotateFilesToKeep = 5
64+
defaultLogRotateInterval = time.Minute * 60 * 24
65+
defaultInstanceUpTimeoutLinux = time.Second * 300
66+
defaultInstanceUpTimeoutWindows = time.Second * 900
6567
)
6668

6769
var (
68-
projectVersion = "dev"
69-
projectBuild = "dev"
70-
cmdMain = &cobra.Command{
70+
defaultInstanceUpTimeout = defaultInstanceUpTimeoutLinux
71+
projectVersion = "dev"
72+
projectBuild = "dev"
73+
cmdMain = &cobra.Command{
7174
Use: projectName,
7275
Short: "Start ArangoDB clusters & single servers with ease",
7376
Run: cmdMainRun,
@@ -141,6 +144,7 @@ var (
141144
passthroughOptions = make(map[string]*service.PassthroughOption)
142145
debugCluster bool
143146
enableSync bool
147+
instanceUpTimeout time.Duration
144148
syncMonitoringToken string
145149
syncMasterKeyFile string // TLS keyfile of local sync master
146150
syncMasterClientCAFile string // CA Certificate used for client certificate verification
@@ -166,6 +170,10 @@ func init() {
166170
defaultLogColor = false
167171
}
168172

173+
if runtime.GOOS == "windows" {
174+
defaultInstanceUpTimeout = defaultInstanceUpTimeoutWindows
175+
}
176+
169177
// Prepare commandline parser
170178
cmdMain.AddCommand(cmdVersion)
171179

@@ -186,6 +194,7 @@ func init() {
186194
f.BoolVar(&debugCluster, "starter.debug-cluster", getEnvVar("DEBUG_CLUSTER", "") != "", "If set, log more information to debug a cluster")
187195
f.BoolVar(&disableIPv6, "starter.disable-ipv6", !net.IsIPv6Supported(), "If set, no IPv6 notation will be used. Use this only when IPv6 address family is disabled")
188196
f.BoolVar(&enableSync, "starter.sync", false, "If set, the starter will also start arangosync instances")
197+
f.DurationVar(&instanceUpTimeout, "starter.instance-up-timeout", defaultInstanceUpTimeout, "Timeout to wait for an instance start")
189198

190199
pf.BoolVar(&verbose, "log.verbose", false, "Turn on debug logging")
191200
pf.BoolVar(&logOutput.Console, "log.console", true, "Send log output to console")

0 commit comments

Comments
 (0)