Skip to content

Commit

Permalink
Support k8s secrets in console pod (#1800)
Browse files Browse the repository at this point in the history
  • Loading branch information
cniackz authored Oct 10, 2023
1 parent b345b04 commit d619113
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/certs/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,21 @@ func NewConfigDirFromCtx(ctx *cli.Context, option string, getDefaultDir func() s
}

func getPublicCertFile() string {
return filepath.Join(GlobalCertsDir.Get(), PublicCertFile)
publicCertFile := filepath.Join(GlobalCertsDir.Get(), PublicCertFile)
TLSCertFile := filepath.Join(GlobalCertsDir.Get(), TLSCertFile)
if isFile(publicCertFile) {
return publicCertFile
}
return TLSCertFile
}

func getPrivateKeyFile() string {
return filepath.Join(GlobalCertsDir.Get(), PrivateKeyFile)
privateKeyFile := filepath.Join(GlobalCertsDir.Get(), PrivateKeyFile)
TLSPrivateKey := filepath.Join(GlobalCertsDir.Get(), TLSKeyFile)
if isFile(privateKeyFile) {
return privateKeyFile
}
return TLSPrivateKey
}

// EnvCertPassword is the environment variable which contains the password used
Expand Down
6 changes: 6 additions & 0 deletions pkg/certs/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ const (
// PublicCertFile Public certificate file for HTTPS.
PublicCertFile = "public.crt"

// TLSCertFile Public certificate file for HTTPS.
TLSCertFile = "tls.crt"

// PrivateKeyFile Private key file for HTTPS.
PrivateKeyFile = "private.key"

// TLSKeyFile Private key file for HTTPS.
TLSKeyFile = "tls.key"
)

0 comments on commit d619113

Please sign in to comment.