-
-
Notifications
You must be signed in to change notification settings - Fork 322
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: Enhance repo/env with Granular Service-Based Environment Variable Validation #228
Comments
Hey @enolcasielles cool idea! Definitely open to checking out a PR that implements this. |
Added Flags: ENABLE_CLERK, ENABLE_STRIPE, ENABLE_RESEND. Dynamic Validation: The server schema includes service-specific fields only if their respective flags are enabled. Improved Modularity: This allows for better control over which services are active and their corresponding required variables.
Feature added on PR #252 |
I’d suggest something like this. This approach remains compatible with previous versions. If the ENABLE_SERVICES_FLAGS environment variable is not defined, everything works as it did before. Alternatively, we could modify this behavior and make flag variables mandatory. I’d like to hear your thoughts on which approach is better, @haydenbleasel. In any case, when this behavior is enabled, the functionality is straightforward: all variables are divided into services. The user must specify which services a single app needs to use. Once a service is enabled, all related variables are checked. The commit also includes a sample env.example file. |
Currently, the
repo/env
package enforces validation of all required environment variables for the different services involved (Clerk, Stripe, Resend, etc.), which means that all applications or packages usingrepo/env
must define all environment variables, regardless of whether they need them or not. I have seen an issue suggesting the creation of a symlink to a file at the project root, which I believe is a very good solution to improve the development experience. However, this approach would still leave some issues unresolved.Proposed Solution
I propose a more granular solution that allows grouping environment variables by service. The idea is to use boolean flag variables to enable or disable specific services at the application level. By default, services would be disabled. Each app would first set the flag variable of the required service to true and then define the necessary variables for that service. The
repo/env
package would evaluate which services are active and would configure the validation schema accordingly.This approach would:
Next Steps
If this proposal is of interest, I am willing to create a PR with the necessary changes to implement it.
The text was updated successfully, but these errors were encountered: