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

Bug: declaring a config field with environment variable is not working #701

Closed
outerlook opened this issue May 6, 2024 · 1 comment · Fixed by #705 or #706
Closed

Bug: declaring a config field with environment variable is not working #701

outerlook opened this issue May 6, 2024 · 1 comment · Fixed by #705 or #706
Assignees
Labels
bug Something isn't working

Comments

@outerlook
Copy link

outerlook commented May 6, 2024

Version / Commit

v0.7.3

Operating System

Ubuntu 22.04.4 LTS

Configuration

I'd like to configure just one field using env variables, in this case:

[chain.p2p]
external_address = <this one>

I used this env variable to configure it:

KWILD_CHAIN_P2P_EXTERNAL_ADDRESS=kwil-node-1:2656

Expected Behavior

I'd expect the config to be populated with the env string.

Actual Behavior

config is not picked up

Steps to Reproduce

  1. setup any server with some custom value for KWILD_CHAIN_P2P_EXTERNAL_ADDRESS
  2. in debug mode, put a breakpoint at https://github.com/kwilteam/kwil-db/blob/main/cmd/kwild/config/config.go#L346
  3. see that the config didn't use it and envConfig is in an empty state.

image
3. see that the config didn't use it and envConfig is in an empty state.

Additional Information

Or did I pick something wrong from the docs? Not to be discarded 😅

Another note is that only one level of the configuration structure seems unmarshalled by viper.
It looks for KWILD_ROOTDIR, KWILD_APP, KWILD_CHAIN, and KWILD_LOG, then stops.

It is not urgent, as it has workarounds.

@outerlook outerlook added the bug Something isn't working label May 6, 2024
@brennanjl
Copy link
Collaborator

Thanks for bringing this up! cc @charithabandi

@charithabandi charithabandi linked a pull request May 7, 2024 that will close this issue
@charithabandi charithabandi self-assigned this May 8, 2024
@charithabandi charithabandi linked a pull request May 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants