Skip to content

Commit bdda6a6

Browse files
committed
tools/geneos: Fix Java command line ordering for webserver, allowing truststore to work. Also update default for truststore to use instance home directory
1 parent cfa81b9 commit bdda6a6

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.18.1
1+
v1.18.2

tools/geneos/internal/component/webserver/webserver.go

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var Webserver = geneos.Component{
9898
`maxmem=1024m`,
9999
`autostart=true`,
100100
// customised cacerts - can be to a shared one if required
101-
`truststore={{join .home "cacerts"}}`,
101+
`truststore={{join "${config:home}" "cacerts"}}`,
102102
},
103103

104104
Directories: []string{
@@ -366,12 +366,28 @@ func (w *Webservers) Command() (args, env []string, home string) {
366366
// "-Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false",
367367
"-XX:+HeapDumpOnOutOfMemoryError",
368368
"-XX:HeapDumpPath=/tmp",
369-
"-jar", base + "/geneos-web-server.jar",
370-
"-dir", base + "/webapps",
369+
}
370+
371+
javaopts := strings.Fields(cf.GetString("java-options"))
372+
args = append(args, javaopts...)
373+
374+
if truststorePath := cf.GetString("truststore"); truststorePath != "" {
375+
args = append(args, "-Djavax.net.ssl.trustStore="+truststorePath)
376+
}
377+
378+
// fetch password as string as it has to be exposed on the command line anyway
379+
if truststorePassword := cf.GetString("truststore-password"); truststorePassword != "" {
380+
args = append(args, "-Djavax.net.ssl.trustStorePassword="+truststorePassword)
381+
}
382+
383+
// -jar must appear after all options are set otherwise they are
384+
// seen as arguments to the application
385+
args = append(args,
386+
"-jar", base+"/geneos-web-server.jar",
387+
"-dir", base+"/webapps",
371388
"-port", cf.GetString("port"),
372389
"-maxThreads 254",
373-
// "-log", LogFile(c),
374-
}
390+
)
375391

376392
tlsFiles := instance.Filepaths(w, "certificate", "privatekey")
377393
if len(tlsFiles) == 0 || tlsFiles[0] == "" {
@@ -383,15 +399,6 @@ func (w *Webservers) Command() (args, env []string, home string) {
383399
args = append(args, "-ssl", "true")
384400
}
385401

386-
if truststorePath := cf.GetString("truststore"); truststorePath != "" {
387-
args = append(args, "-Djavax.net.ssl.trustStore="+truststorePath)
388-
}
389-
390-
// fetch password as string as it has to be exposed on the command line anyway
391-
if truststorePassword := cf.GetString("truststore-password"); truststorePassword != "" {
392-
args = append(args, "-Djavax.net.ssl.trustStorePassword="+truststorePassword)
393-
}
394-
395402
return
396403
}
397404

0 commit comments

Comments
 (0)