Skip to content

Commit

Permalink
bugfixing, using home var instead of home var string
Browse files Browse the repository at this point in the history
Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira committed May 19, 2024
1 parent c065a22 commit 06b33e8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ui/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ func main() {
InstructLabBotUrl := pflag.String("bot-url", InstructLabBotUrl, "InstructLab Bot URL")
// TLS variables
tlsInsecure := pflag.Bool("tls-insecure", false, "Whether to skip TLS verification")
tlsClientCertPath := pflag.String("tls-client-cert", "$HOME/client-tls-crt.pem2", "Path to the TLS client certificate. Defaults to 'client-tls-crt.pem2'")
tlsClientKeyPath := pflag.String("tls-client-key", "$HOME/client-tls-key.pem2", "Path to the TLS client key. Defaults to 'client-tls-key.pem2'")
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'")
tlsClientCertPath := pflag.String("tls-client-cert", "", "Path to the TLS client certificate. Evantually defaults to '$HOME/client-tls-crt.pem2'")
tlsClientKeyPath := pflag.String("tls-client-key", "", "Path to the TLS client key. Evantually defaults to '$HOME/client-tls-key.pem2'")
tlsServerCaCertPath := pflag.String("tls-server-ca-cert", "", "Path to the TLS server CA certificate. Evantually defaults to '$HOME/server-ca-crt.pem2'")
pflag.Parse()

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

// Precheck endpoint
HOME := os.Getenv("HOME")
if *preCheckEndpointURL == "" {
preCheckEndpointURLEnvValue := os.Getenv("PECHECK_ENDPOINT")
if preCheckEndpointURLEnvValue != "" {
Expand All @@ -547,6 +546,7 @@ func main() {
}

// TLS configurations
HOME := os.Getenv("HOME")
if *tlsClientCertPath == "" {
tlsClientCertPathEnvValue := os.Getenv("TLS_CLIENT_CERT_PATH")
if tlsClientCertPathEnvValue != "" {
Expand All @@ -564,6 +564,14 @@ func main() {
*tlsClientKeyPath = fmt.Sprintf("%s/client-tls-key.pem2", HOME)
}
}
if *tlsServerCaCertPath == "" {
tlsServerCaCertPathEnvValue := os.Getenv("TLS_SERVER_CA_CERT_PATH")
if tlsServerCaCertPathEnvValue != "" {
*tlsServerCaCertPath = tlsServerCaCertPathEnvValue
} else {
*tlsServerCaCertPath = fmt.Sprintf("%s/server-ca-crt.pem2", HOME)
}
}

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

Expand Down

0 comments on commit 06b33e8

Please sign in to comment.