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

Feature request: Exporting all services at once #341

Open
syphernl opened this issue May 3, 2022 · 2 comments
Open

Feature request: Exporting all services at once #341

syphernl opened this issue May 3, 2022 · 2 comments

Comments

@syphernl
Copy link

syphernl commented May 3, 2022

Imagine the following chamber list-services output:

Service
app/aws
app/bucket
app/secrets

Right now you cannot do chamber export app but need to explicitly provide the service name e.g. chamber export app/aws.
It would be nice if one could export the entire tree, using the service as a prefix.

For instance if one had such SSM parameter setup:

app/aws/region = "foo"
app/bucket/foo = "bar"
app/bucket/bar = "baz"
app/secrets/hash = "xyz"

chamber export app could then produce something like:

AWS_REGION="foo"
BUCKET_FOO="bar"
BUCKET_BAR="baz"
SECRETS_HASH="xyz"
@kevcube
Copy link
Contributor

kevcube commented May 4, 2022

looks related to #334

@bhavanki
Copy link
Contributor

bhavanki commented Mar 7, 2024

I haven't been involved in this project previously, but would like to respond. (I'm a Segment employee.)

I reported some analysis and ideas in a related issue and I'll expand on that here.

There are a couple of problems (not insurmountable!) with the suggestion in this issue.

  • chamber doesn't recurse down a path-like structure for service names anywhere at the moment, as far as I can tell. For example, export could produce AWS_REGION="foo" due to some SSM parameter named "app/aws/region", but chamber exec app or chamber list app won't notice it. Maybe it'd be enough if chamber import similarly interpreted the export output as paths, but ...
  • When chamber converts parameter names into environment variable names (this is for the dotenv format), it converts characters besides / - notably . - into underscores. At that point, there's no indication whether the underscore is a path separator or not. So, the import process wouldn't know how to construct the original hierarchy. (Maybe we'd accept that as a lossy output format that can't be reliably imported, because other formats preserve the hierarchy.)

I think a --recursive option like I suggested in the other issue could work well here. Also, an alternative that works today is to use dot separators for the chamber keys, so for example:

chamber write app aws.region us-west-2

That leads to a parameter name "app/aws.region", so if there are other processes reading the raw parameter and expecting a nice hierarchy, well, they'd be disappointed. But, it would produce the desired AWS_REGION environment variable name.

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

No branches or pull requests

4 participants