uber-go / config

Configuration for Go applications
https://godoc.org/go.uber.org/config
MIT License
442 stars 41 forks source link

Error loading env variables over some size #115

Closed jskelcy closed 2 months ago

jskelcy commented 4 years ago

I have a project where I am loading large env variables using the os.LookupEnv function. When doing so I see this error: couldn't expand environment: transform: short destination buffer

The library would ideally be able to handle arbitrarily large env variables.

blampe commented 4 years ago

Hi Jake! Hope you're well :)

When you say "large," how many bytes roughly? Do you have a code snippet that roughly captures what you're trying to do?

jskelcy commented 4 years ago

Bryce, Hope things are going good for you too.

Yes including the size would have been a reasonable thing to do given the ticket. In this case, I am passing in a 4324 byte env var. Which is larger than the default buffer from the transform package this library is using, this might be the issue.

As far as a code snippet I believe I am doing this in the standard way:

        provider, err = config.NewYAML(
            config.Expand(os.LookupEnv),
            config.File(basePath),
        )

I'm just passing in a rather large private key into an application, which due to my deploy process is best passed in as an env var as it provides the most flexibility.