Skip to content

Commit 06b33e8

Browse files
bugfixing, using home var instead of home var string
Signed-off-by: greg pereira <[email protected]>
1 parent c065a22 commit 06b33e8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ui/apiserver/apiserver.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,9 @@ func main() {
521521
InstructLabBotUrl := pflag.String("bot-url", InstructLabBotUrl, "InstructLab Bot URL")
522522
// TLS variables
523523
tlsInsecure := pflag.Bool("tls-insecure", false, "Whether to skip TLS verification")
524-
tlsClientCertPath := pflag.String("tls-client-cert", "$HOME/client-tls-crt.pem2", "Path to the TLS client certificate. Defaults to 'client-tls-crt.pem2'")
525-
tlsClientKeyPath := pflag.String("tls-client-key", "$HOME/client-tls-key.pem2", "Path to the TLS client key. Defaults to 'client-tls-key.pem2'")
526-
tlsServerCaCertPath := pflag.String("tls-server-ca-cert", "$HOME/server-ca-crt.pem2", "Path to the TLS server CA certificate. Defaults to 'server-ca-crt.pem2'")
524+
tlsClientCertPath := pflag.String("tls-client-cert", "", "Path to the TLS client certificate. Evantually defaults to '$HOME/client-tls-crt.pem2'")
525+
tlsClientKeyPath := pflag.String("tls-client-key", "", "Path to the TLS client key. Evantually defaults to '$HOME/client-tls-key.pem2'")
526+
tlsServerCaCertPath := pflag.String("tls-server-ca-cert", "", "Path to the TLS server CA certificate. Evantually defaults to '$HOME/server-ca-crt.pem2'")
527527
pflag.Parse()
528528

529529
/* ENV support, most variabls take 3 options, with the following priority:
@@ -536,7 +536,6 @@ func main() {
536536
// With no comment, assume they support all 3.
537537

538538
// Precheck endpoint
539-
HOME := os.Getenv("HOME")
540539
if *preCheckEndpointURL == "" {
541540
preCheckEndpointURLEnvValue := os.Getenv("PECHECK_ENDPOINT")
542541
if preCheckEndpointURLEnvValue != "" {
@@ -547,6 +546,7 @@ func main() {
547546
}
548547

549548
// TLS configurations
549+
HOME := os.Getenv("HOME")
550550
if *tlsClientCertPath == "" {
551551
tlsClientCertPathEnvValue := os.Getenv("TLS_CLIENT_CERT_PATH")
552552
if tlsClientCertPathEnvValue != "" {
@@ -564,6 +564,14 @@ func main() {
564564
*tlsClientKeyPath = fmt.Sprintf("%s/client-tls-key.pem2", HOME)
565565
}
566566
}
567+
if *tlsServerCaCertPath == "" {
568+
tlsServerCaCertPathEnvValue := os.Getenv("TLS_SERVER_CA_CERT_PATH")
569+
if tlsServerCaCertPathEnvValue != "" {
570+
*tlsServerCaCertPath = tlsServerCaCertPathEnvValue
571+
} else {
572+
*tlsServerCaCertPath = fmt.Sprintf("%s/server-ca-crt.pem2", HOME)
573+
}
574+
}
567575

568576
// NOTE: TLSInsecure not settable by env, just apiserver cli flag or defaults to false
569577

0 commit comments

Comments
 (0)