Is there a way to export an environment variable with a slash in the name such as:
export /myapp/db/username=someval
This post indicates it should be possible but I cannot figure out valid syntax to do so.
For background:
I am using confd to produce config files from a template and key store. The typical stores (consul, etcd) use hierarchical keys such as /myapp/db/username
. I would like to transparently allow for switching between using an environment variable based provider and a configuration store that leverages hierarchical keys.
export
only marks valid shell identifiers to be exported into the environment, not any string that could form a valid name/value pair in the environment. You can useenv
to create a new shell instance with such an environment, though.