2016-04-01 18:23:15 +00:00
|
|
|
package command
|
|
|
|
|
2016-04-01 20:02:18 +00:00
|
|
|
import "github.com/hashicorp/vault/command/token"
|
2016-04-01 18:23:15 +00:00
|
|
|
|
|
|
|
// DefaultTokenHelper returns the token helper that is configured for Vault.
|
2016-04-01 20:02:18 +00:00
|
|
|
func DefaultTokenHelper() (token.TokenHelper, error) {
|
|
|
|
config, err := LoadConfig("")
|
2016-04-01 18:23:15 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
path := config.TokenHelper
|
|
|
|
if path == "" {
|
|
|
|
return &token.InternalTokenHelper{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
path, err = token.ExternalTokenHelperPath(path)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &token.ExternalTokenHelper{BinaryPath: path}, nil
|
|
|
|
}
|