Skip to content

Env-vars expect lower case letters #583

@mostafa

Description

@mostafa

I found a tiny bug (more of an assumption on how things work) in processing environment variables. The strings.ToLower in the loadEnvVars() function assumes that all keys are in lower case, yet the config blocks are camel case, like activeWrites.

As a result, the GATEWAYD_POOLS_DEFAULT_ACTIVEWRITES_SIZE=1 gets converted to map[pools:map[default:map[activewrites:map[size:1]]]], which is incorrect because it creates a new config block: activewrites (notice the lower case).

I removed the strings.ToLower function and tested it with normal cased env-vars. Now, using GATEWAYD_pools_default_activeWrites_size=1 gets converted to map[pools:map[default:map[activeWrites:map[size:1]]]] and it works as expected.

However, environment variables are usually written in upper case letters, so we need to find a fix for this that accommodates the convention of upper case env-vars without breaking the camel case config blocks.

This is related to recent changes in #577.

A viable solution is to disregard the casing and only accept lower case config blocks (and maybe config groups). And then ensure that we are converting all the keys to lower case before loading the configuration from the file.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

🎉 Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions