mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-05 04:13:11 +02:00
k8s cmd: use authclient package (#1722)
This commit is contained in:
parent
ab44f6b057
commit
796ad2ded8
4 changed files with 38 additions and 134 deletions
|
@ -1,10 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
|
@ -22,3 +25,18 @@ func fatalf(msg string, args ...interface{}) {
|
|||
fmt.Fprintf(os.Stderr, msg+"\n", args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func getTLSConfig(insecureSkipVerify bool, caCert, alternateCAPath string) *tls.Config {
|
||||
cfg := new(tls.Config)
|
||||
if insecureSkipVerify {
|
||||
cfg.InsecureSkipVerify = true
|
||||
}
|
||||
if caCert != "" {
|
||||
var err error
|
||||
cfg.RootCAs, err = cryptutil.GetCertPool(caCert, alternateCAPath)
|
||||
if err != nil {
|
||||
fatalf("%s", err)
|
||||
}
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue