Feature Request: tag fields for exclusion
coreyog opened this issue · comments
I'm thinking of using this project for printing configs when my api starts. The first thing I do is load up a config file and I'd like to print it out when the API starts so the log knows exactly what values the app is running with. My concern is that my config holds the paths to RSA keys, passwords to open the keys, and when the key is decrypted I store it's value in the config as well.
I'm ok printing the path to the key, but I don't want to print the password or the private key contents. It would be nice if I could tag an object like so:
type Config struct {
Port int `yaml:"port"`
BoltDBPath string `yaml:"boltDbPath"`
GracefulShutdownTimeout time.Duration `yaml:"gracefulShutdownTimeout"`
Issuer string `yaml:"issuer"`
SigningKeyPath string `yaml:"signingKey"`
SigningKeyRaw *rsa.PrivateKey `yaml:"-" spew:"-"`
SigningPassword string `yaml:"signingPassword" spew:"-"`
PublicKeyPath string `yaml:"publicKey"`
PublicKeyRaw *rsa.PublicKey `yaml:"-" spew:"-"`
LogOutput string `yaml:"logOutput"`
RateLimitPerSecond int64 `yaml:"rateLimitPerSecond"`
Debug bool `yaml:"debug"`
}
Note that SigningKeyRaw, SigningPassword, and PublicKeyRaw have the tag spew:"-"
as a way to indicate that spew should not print these fields' contents.