add template func get_keystore_secret
This commit is contained in:
parent
ffde139506
commit
64b8d4481b
|
@ -32,4 +32,5 @@ var genericMap = map[string]interface{}{
|
|||
"div": div,
|
||||
"mul": mul,
|
||||
"lookup": lookup,
|
||||
"get_keystore_secret": getKeystoreSecret,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/* Copyright © INFINI Ltd. All rights reserved.
|
||||
* Web: https://infinilabs.com
|
||||
* Email: hello#infini.ltd */
|
||||
|
||||
package funcs
|
||||
|
||||
import (
|
||||
log "github.com/cihub/seelog"
|
||||
"infini.sh/framework/core/keystore"
|
||||
)
|
||||
|
||||
func getKeystoreSecret(key string) string {
|
||||
vBytes, err := keystore.GetValue(key)
|
||||
if err != nil {
|
||||
log.Error("retrieve secret error: ", err)
|
||||
return "N/A"
|
||||
}
|
||||
return string(vBytes)
|
||||
}
|
Loading…
Reference in New Issue