mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 05:23:33 +02:00
use password-source-path to allow overriding binary and/or path to binary
This commit is contained in:
+2
-1
@@ -72,7 +72,8 @@ type GlobalOptions struct {
|
||||
// location using the `pass` tool, if missing prompt the user and store in the PasswordDirectory
|
||||
PasswordSource figtree.StringOption `yaml:"password-source,omitempty" json:"password-source,omitempty"`
|
||||
|
||||
PasswordSourceBinary figtree.StringOption `yaml:"password-source-binary,omitempty" json:"password-source-binary,omitempty"`
|
||||
// PasswordSourcePath can be used to specify the path to the PasswordSource binary to use.
|
||||
PasswordSourcePath figtree.StringOption `yaml:"password-source-path,omitempty" json:"password-source-path,omitempty"`
|
||||
|
||||
// PasswordDirectory is only used for the "pass" PasswordSource. It is the location for the encrypted password
|
||||
// files used by `pass`. Effectively this overrides the "PASSWORD_STORE_DIR" environment variable
|
||||
|
||||
+11
-17
@@ -41,18 +41,13 @@ func (o *GlobalOptions) keyName() string {
|
||||
return user
|
||||
}
|
||||
|
||||
func (o *GlobalOptions) GetPasswordBinary() string {
|
||||
binary := o.PasswordSourceBinary.Value
|
||||
|
||||
if binary == "" {
|
||||
if o.PasswordSource.Value == "gopass" {
|
||||
return "gopass"
|
||||
} else if o.PasswordSource.Value == "pass" {
|
||||
return "pass"
|
||||
}
|
||||
}
|
||||
|
||||
return binary
|
||||
func (o *GlobalOptions) GetPasswordPath() string {
|
||||
// if no password source path then just default
|
||||
// to the password source name
|
||||
if o.PasswordSourcePath.Value == "" {
|
||||
return o.PasswordSource.Value
|
||||
}
|
||||
return o.PasswordSourcePath.Value
|
||||
}
|
||||
|
||||
func (o *GlobalOptions) GetPass() string {
|
||||
@@ -66,9 +61,8 @@ func (o *GlobalOptions) GetPass() string {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else if o.PasswordSource.Value == "gopass" && o.GetPasswordBinary() != "" {
|
||||
binary := o.GetPasswordBinary()
|
||||
|
||||
} else if o.PasswordSource.Value == "gopass" {
|
||||
binary := o.GetPasswordPath()
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
log.Debugf("using password-directory: %s", o.PasswordDirectory)
|
||||
@@ -92,8 +86,8 @@ func (o *GlobalOptions) GetPass() string {
|
||||
} else {
|
||||
log.Warning("Gopass binary was not found! Fallback to default password behaviour!")
|
||||
}
|
||||
} else if o.PasswordSource.Value == "pass" && o.GetPasswordBinary() != "" {
|
||||
binary := o.GetPasswordBinary()
|
||||
} else if o.PasswordSource.Value == "pass" {
|
||||
binary := o.GetPasswordPath()
|
||||
if o.PasswordDirectory.Value != "" {
|
||||
orig := os.Getenv("PASSWORD_STORE_DIR")
|
||||
log.Debugf("using password-directory: %s", o.PasswordDirectory)
|
||||
|
||||
Reference in New Issue
Block a user