Documentation ¶
Index ¶
- func Bool(ctx context.Context, key string) bool
- func Directory() string
- func HasGlobalConfig() bool
- func Int(ctx context.Context, key string) int
- func PwStoreDir(mount string) string
- func String(ctx context.Context, key string) string
- type Config
- func (c *Config) Get(key string) string
- func (c *Config) GetAll(key string) []string
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetInt(key string) int
- func (c *Config) GetM(mount, key string) string
- func (c *Config) IsSet(key string) bool
- func (c *Config) Keys(mount string) []string
- func (c *Config) MountPath(mountPoint string) string
- func (c *Config) Mounts() []string
- func (c *Config) Path() string
- func (c *Config) Set(mount, key, value string) error
- func (c *Config) SetEnv(key, value string) error
- func (c *Config) SetMountPath(mount, path string) error
- func (c *Config) SetPath(path string) error
- func (c *Config) Unset(mount, key string) error
- func (c *Config) WithConfig(ctx context.Context) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Directory ¶
func Directory() string
Directory returns the configuration directory for the gopass config file.
func HasGlobalConfig ¶ added in v1.15.1
func HasGlobalConfig() bool
HasGlobalConfig returns true if there is an existing global config.
func PwStoreDir ¶
PwStoreDir reads the password store dir from the environment or returns the default location if the env is not set.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a gopass config handler.
func FromContext ¶ added in v1.15.0
func New ¶
func New() *Config
New initializes a new gopass config. It will handle legacy configs as well.
func NewNoWrites ¶ added in v1.15.0
func NewNoWrites() *Config
NewNoWrites initializes a new config that does not allow writes. For use in tests.
func (*Config) GetBool ¶ added in v1.15.0
GetBool returns true if the value of the key evaluates to "true". Otherwise it returns false.
func (*Config) GetInt ¶ added in v1.15.0
GetInt returns the integer value of the key if it can be parsed. Otherwise it returns 0.
func (*Config) GetM ¶ added in v1.15.0
GetM returns the given key from the mount or the root config if mount is empty.
func (*Config) Mounts ¶
Mounts returns all mount points from the root config. Note: Any mounts in local configs are ignored.
func (*Config) Set ¶ added in v1.15.0
Set tries to set the key to the given value. The mount option is necessary to discern between the per-user (global) and possible per-directory (local) config files.
- If mount is empty the setting will be written to the per-user config (global)
- If mount has the special value "<root>" the setting will be written to the per-directory config of the root store (local)
- If mount has any other value we will attempt to write the setting to the per-directory config of this mount.
- If the mount point does not exist we will return nil.
func (*Config) SetMountPath ¶ added in v1.15.0
SetMountPath is a short cut to set a mount to a path.