Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: tag fields for exclusion #97

Open
coreyog opened this issue Dec 22, 2018 · 0 comments
Open

Feature Request: tag fields for exclusion #97

coreyog opened this issue Dec 22, 2018 · 0 comments

Comments

@coreyog
Copy link

coreyog commented Dec 22, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant