Skip to content

Commit

Permalink
Implement Global (Target-Independent) Options (#227)
Browse files Browse the repository at this point in the history
* Basic implementation of global options - WIP

* Automatically populate global options in the config
  • Loading branch information
daviddob authored Mar 24, 2021
1 parent 53c8ba3 commit f37ab3a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ type Config struct {
Version int `yaml:"version"`
Current string `yaml:"current"`
Vaults map[string]*Vault `yaml:"vaults"`
Options Options `yaml:"options"`
}

type Options struct {
ManageVaultToken bool `yaml:"manage_vault_token"`
}

type Vault struct {
Expand Down Expand Up @@ -149,6 +154,9 @@ func (c *Config) Write() error {
if err != nil {
return err
}
if c.Options.ManageVaultToken {
ioutil.WriteFile(fmt.Sprintf("%s/.vault-token", userHomeDir()), []byte(v.Token), 0600)
}

return ioutil.WriteFile(svtoken(), b, 0600)
}
Expand Down

0 comments on commit f37ab3a

Please sign in to comment.