Skip to content

support optional trim #195

@fernandodr19

Description

@fernandodr19

I've ran into an issue recently where a subtle new line character was incorrectly added by the devops team at the end of a password in a config file, which led to an error in authentication. This took me quite some time to figure out as we were moving into new servers with new credentials and the env output was rather subtle as I didn't really expect this to be an issue.

As these secrets are handled by different teams, I cannot be sure that this won't happen again and would like to defend against it. This could easily be avoided if we had an option to trim variables, for example. I was thinking of something like

type config struct {
    MyPass string `envconfig:"MY_PASS" trim:"true"`
}

Or something along those lines. What do you guys think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions