mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 13:33:32 +02:00
[#157] add password-directory: path to allow overriding PASSWORD_STORE_DIR from configs
This commit is contained in:
@@ -33,6 +33,7 @@ type GlobalOptions struct {
|
||||
Insecure figtree.BoolOption `yaml:"insecure,omitempty" json:"insecure,omitempty"`
|
||||
Login figtree.StringOption `yaml:"login,omitempty" json:"login,omitempty"`
|
||||
PasswordSource figtree.StringOption `yaml:"password-source,omitempty" json:"password-source,omitempty"`
|
||||
PasswordDirectory figtree.StringOption `yaml:"password-directory,omitempty" json:"password-directory,omitempty"`
|
||||
Quiet figtree.BoolOption `yaml:"quiet,omitempty" json:"quiet,omitempty"`
|
||||
SocksProxy figtree.StringOption `yaml:"socksproxy,omitempty" json:"socksproxy,omitempty"`
|
||||
UnixProxy figtree.StringOption `yaml:"unixproxy,omitempty" json:"unixproxy,omitempty"`
|
||||
|
||||
@@ -40,6 +40,11 @@ func (o *GlobalOptions) GetPass() string {
|
||||
panic(err)
|
||||
}
|
||||
} else if o.PasswordSource.Value == "pass" {
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
|
||||
defer os.Setenv("PASSWORD_STORE_DIR", orig)
|
||||
}
|
||||
if bin, err := exec.LookPath("pass"); err == nil {
|
||||
buf := bytes.NewBufferString("")
|
||||
cmd := exec.Command(bin, o.keyName())
|
||||
@@ -95,6 +100,11 @@ func (o *GlobalOptions) SetPass(passwd string) error {
|
||||
return err
|
||||
}
|
||||
} else if o.PasswordSource.Value == "pass" {
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
os.Setenv("PASSWORD_STORE_DIR", o.PasswordDirectory.Value)
|
||||
defer os.Setenv("PASSWORD_STORE_DIR", orig)
|
||||
}
|
||||
if bin, err := exec.LookPath("pass"); err == nil {
|
||||
log.Debugf("using %s", bin)
|
||||
passName := o.keyName()
|
||||
|
||||
Reference in New Issue
Block a user