WIP: feat: translation support
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
See #483
This commit is contained in:
@ -6,12 +6,13 @@ import (
|
||||
"os/exec"
|
||||
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
)
|
||||
|
||||
// PassInsertSecret inserts a secret into a pass store.
|
||||
func PassInsertSecret(secretValue, secretName, appName, server string) error {
|
||||
if _, err := exec.LookPath("pass"); err != nil {
|
||||
return errors.New("pass command not found on $PATH, is it installed?")
|
||||
return errors.New(gotext.Get("pass command not found on $PATH, is it installed?"))
|
||||
}
|
||||
|
||||
cmd := fmt.Sprintf(
|
||||
@ -19,13 +20,13 @@ func PassInsertSecret(secretValue, secretName, appName, server string) error {
|
||||
secretValue, server, appName, secretName,
|
||||
)
|
||||
|
||||
log.Debugf("attempting to run %s", cmd)
|
||||
log.Debug(gotext.Get("attempting to run %s", cmd))
|
||||
|
||||
if err := exec.Command("bash", "-c", cmd).Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("%s inserted into pass store", secretName)
|
||||
log.Infof(gotext.Get("%s inserted into pass store", secretName))
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -33,7 +34,7 @@ func PassInsertSecret(secretValue, secretName, appName, server string) error {
|
||||
// PassRmSecret deletes a secret from a pass store.
|
||||
func PassRmSecret(secretName, appName, server string) error {
|
||||
if _, err := exec.LookPath("pass"); err != nil {
|
||||
return errors.New("pass command not found on $PATH, is it installed?")
|
||||
return errors.New(gotext.Get("pass command not found on $PATH, is it installed?"))
|
||||
}
|
||||
|
||||
cmd := fmt.Sprintf(
|
||||
@ -41,13 +42,13 @@ func PassRmSecret(secretName, appName, server string) error {
|
||||
server, appName, secretName,
|
||||
)
|
||||
|
||||
log.Debugf("attempting to run %s", cmd)
|
||||
log.Debug(gotext.Get("attempting to run %s", cmd))
|
||||
|
||||
if err := exec.Command("bash", "-c", cmd).Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("%s removed from pass store", secretName)
|
||||
log.Infof(gotext.Get("%s removed from pass store", secretName))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user