Skip to content

environment variables cannot use a dash in its name #13

Description

@jakguel

Hello Guys

i encountered following problem
My Plugin has a dash in its name, e.g. "my-plugin"
So when i try to set an variable like this in my env:
APPCONF_my-plugin_myvar=1

This will not work in bash/sh or whatever shell. It works in Docker Compose and Kubernetes if you set the env variable there, but thats because docker passes the env variables in a different way.
In my case i needed to run a shell script because of an dependent arithmetic expression as value:
eval export APPCONF_my-plugin_myvar=$(( BLAH + X )) which will result in an error like this :sh: export: APPCONF_my-plugin_myvar: bad variable name

The reason is: dashes are not supported in environment variabel names.
My solution was to echo the output of my expression into a new toml file, and include it into the original config toml

But what would be easier is if wild-config could just replace something like a double underscore "__" into a dash OR if wild-config would just ignore dashes in plugin names if there is not any collision with another plugin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions