ardanlabs/conf

noprint tag seems to be ignored?

pantelis-karamolegkos opened this issue · 1 comments

type Config struct {
...
	SlackBotToken    string   `conf:"default:'',noprint:true,env:SLACK_BOT_TOKEN,flag:slack-bot-token,help:Bot token"`
...
}

func main() {
       ...
	cfg, err := config.Config()
	if err != nil {
		return errors.Wrapf(err, "error reading config\n")
	}
	out, err := conf.String(cfg)
	if err != nil {
		return errors.Wrap(err, "error generating config for output")
	}
	fmt.Println("starting service ===", "version:", cfg.Version.SVN)
	fmt.Printf("configuration\n%v", out)
       ...
}

execution:

starting service === version: develop
configuration
--svn=develop
--slack-bot-token=xoxx-XDF...

Using 1.5.0 witg go 1.17

It parses noprint, required, mask when it doesn't have any values set.

In your case you want something like:

type Config struct {
...
	SlackBotToken    string   `conf:"default:'',noprint,env:SLACK_BOT_TOKEN,flag:slack-bot-token,help:Bot token"`
...
}