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

feat(secrets): Implement into_iter for SecretStore #1006

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

jonaro00
Copy link
Member

@jonaro00 jonaro00 commented Jun 14, 2023

Description of change

Title~
Came up in a discussion about secrets https://discord.com/channels/803236282088161321/1107140940759568384/1118625700824485928

How has this been tested? (if applicable)

Added test

@dteare
Copy link

dteare commented Jun 14, 2023

For context for others who don't want to wade through the entire Discord thread: basically I'm wanting to use Rocket's outstanding figment feature that allows you to extract config values directly into structs without futzing around. For example, rocket.figment().extract::<OpenAiConfig>() gives me all I need to configure OpenAI without working with each field individually.

Rocket does this automatically based on environment variables. Shuttle Secrets (set via Secrets.toml) do not get injected into applications as environment variables, and so figment and others were sad.

The idea was to work around this limitation by iterating over all the secrets within SecretStore and call std::env::set_var for each one. SecretStore doesn't provide a convenient way to do this, hence Shuttle Hero @jonaro00 jumped into action with this MR.

Copy link
Contributor

@iulianbarbu iulianbarbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@oddgrd oddgrd merged commit 15bd0ae into shuttle-hq:main Jun 20, 2023
AlphaKeks pushed a commit to AlphaKeks/shuttle that referenced this pull request Jun 20, 2023
@jonaro00 jonaro00 deleted the feat/secretstore-intoiter branch September 27, 2023 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants