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

[Plugins]: Improve the Shuttle Secrets plugin #1571

Open
jonaro00 opened this issue Jan 25, 2024 · 6 comments
Open

[Plugins]: Improve the Shuttle Secrets plugin #1571

jonaro00 opened this issue Jan 25, 2024 · 6 comments
Labels
Feature Poll Upvote this issue if you want to see this feature in Shuttle S-Investigation This issue needs further investigation or design to figure out a solution

Comments

@jonaro00
Copy link
Member

The current approach to Secrets is Shuttle-native.
Evolving the plugin could include support for .env files and allowing the secrets to be set as env variables in more stages of the Shuttle deployment.
Ideas are appreciated.


This issue is a part of the Product Feature Poll (all issues). React with 👍 if you want this feature. Comment if you have suggestions related to this feature.

@jonaro00 jonaro00 added Feature Poll Upvote this issue if you want to see this feature in Shuttle S-Investigation This issue needs further investigation or design to figure out a solution labels Jan 25, 2024
@bavalpey
Copy link

I'm thoroughly happy with the simplicity of secrets. It follows similar frameworks such as Cloudflare workers, except is even easier to work with.

Please don't change :(

@DevKAVI
Copy link

DevKAVI commented Jan 28, 2024

Yeah I like the current implementation of using Secrets.toml as the main secret store. So there's no need to introduce yet another new file type to the workspace (.env).
A simple KV storage for that is more than sufficient, at least in all my use cases.

@jonaro00
Copy link
Member Author

jonaro00 commented Jan 30, 2024

To clarify the idea:
We still want setting up secrets to be as easy as it is now. The idea is mainly about making it easier to customize the approach, such as using a .env file if you want to, and the ability to automatically load all secrets into the environment, like dotenv crates do. Another improvement that is probably coming up is to have it built into the shuttle-runtime crate by default so that you don't even need to add a separate crate to use it. There is also room to reduce the boilerplate required when getting secrets from the SecretStore.
How does this sound? @bavalpey @DevKAVI
Edit: Perhaps the title of the issue should be "Improve the Secrets plugin"?

@bavalpey
Copy link

The idea is mainly about making it easier to customize the approach, such as using a .env file if you want to

I think that having multiple ways to do this makes the feature more complicated, and makes reading other projects slightly more involved. There should really only be 2 files capable of setting secrets, one for local runs and one for deployments.
It would also be, well, difficult to differentiate between the deployment secrets and the dev secrets. Having a .env file violates this.

and the ability to automatically load all secrets into the environment, like dotenv crates do.

Now this is great. Definitely would want it to be a deployment flag, though.

Another improvement that is probably coming up is to have it built into the shuttle-runtime crate by default so that you don't even need to add a separate crate to use it.

This makes no difference to me. The only reason I can see to not do this is to avoid pay the compilation cost for an unused module. But I can't imagine the secrets module would have any real impact on compile times.

There is also room to reduce the boilerplate required when getting secrets from the SecretStore. How does this sound?

Now this is something I would be very excited for. It's a bit annoying having to pass around secrets, or throw them into a global static variable. Would love to see this.

@jonaro00
Copy link
Member Author

It would also be, well, difficult to differentiate between the deployment secrets and the dev secrets. Having a .env file violates this.

Next.js uses .env + .env.local + a few other options. Secrets[.dev].toml is an echo of that pattern.

a deployment flag

How about #[shuttle_secrets::Secrets(set_env = true)] secrets: SecretStore? They would be set at runtime (when loading the secrets) with this approach, in which case it makes sense to have it declared in the macro. A deployment flag would imply it couldn't be applied on a local run.

throw them into a global static variable

env vars are kind of like global variables 😏

@jonaro00 jonaro00 changed the title [Plugins]: Revamp the Shuttle Secrets plugin [Plugins]: Improve the Shuttle Secrets plugin Feb 7, 2024
@jonaro00
Copy link
Member Author

jonaro00 commented Mar 8, 2024

Another idea to consider: Supporting a way of automatically parsing it into a struct. #1666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Poll Upvote this issue if you want to see this feature in Shuttle S-Investigation This issue needs further investigation or design to figure out a solution
Projects
None yet
Development

No branches or pull requests

3 participants