Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Decode base64 secrets
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Dec 15, 2020
1 parent 6cccdee commit 42c4087
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package cmd

import (
"bytes"
b64 "encoding/base64"
"fmt"
"io/ioutil"
"log"
Expand Down Expand Up @@ -582,23 +583,23 @@ func installOpenfaas(scaleToZero, ingressOperator bool) error {
}

func getS3Credentials() (string, string, error) {
var accessKey, secretKey string

args := []string{"get", "secret", "-n", "openfaas-fn", "s3-access-key", "-o jsonpath='{.data.s3-access-key}'"}
res, err := k8s.KubectlTask(args...)
if err != nil {
return "", "", err
}
accessKey = res.Stdout
decoded, _ := b64.StdEncoding.DecodeString(res.Stdout)
accessKey := decoded

args = []string{"get", "secret", "-n", "openfaas-fn", "s3-secret-key", "-o jsonpath='{.data.s3-secret-key}'"}
res, err = k8s.KubectlTask(args...)
if err != nil {
return "", "", err
}
secretKey = res.Stdout
decoded, _ = b64.StdEncoding.DecodeString(res.Stdout)
secretKey := decoded

return accessKey, secretKey, nil
return string(accessKey), string(secretKey), nil
}

func installMinio(accessKey, secretKey string) error {
Expand Down

0 comments on commit 42c4087

Please sign in to comment.