fixes and additions:

- add ANYDB_PASSWORD env var
- add config file support, including buckets dict
- finalized custom bucket support
- fine tuned info support
This commit is contained in:
2024-12-22 13:07:53 +01:00
committed by T.v.Dein
parent 24240b85f2
commit 8687e084bf
11 changed files with 258 additions and 32 deletions

View File

@@ -65,7 +65,7 @@ func Set(conf *cfg.Config) *cobra.Command {
// encrypt?
if conf.Encrypt {
pass, err := app.AskForPassword()
pass, err := getPassword()
if err != nil {
return err
}
@@ -118,7 +118,7 @@ func Get(conf *cfg.Config) *cobra.Command {
}
if entry.Encrypted {
pass, err := app.AskForPassword()
pass, err := getPassword()
if err != nil {
return err
}
@@ -371,7 +371,26 @@ func Info(conf *cfg.Config) *cobra.Command {
},
}
cmd.PersistentFlags().StringVarP(&conf.Listen, "listen", "l", "localhost:8787", "host:port")
cmd.PersistentFlags().BoolVarP(&conf.NoHumanize, "no-human", "N", false, "do not translate to human readable values")
return cmd
}
func getPassword() ([]byte, error) {
var pass []byte
envpass := os.Getenv("ANYDB_PASSWORD")
if envpass == "" {
readpass, err := app.AskForPassword()
if err != nil {
return nil, err
}
pass = readpass
} else {
pass = []byte(envpass)
}
return pass, nil
}