You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue proposes an enhancement to the current configuration system by allowing the passing of complete Zod schemas, rather than just object structures. This feature aims to provide greater flexibility and precision in validating environment variables, especially in scenarios requiring conditional validations and multiple configurations.
Detailed Explanation
In applications, which deploy to many different environments, with different set of environment variables having more power over the validation process in terms of which env variables are needed together or which should not nether be used together.
Proposed Solution
From what I can tell, this should be as easy as adapting the types to require a ZodSchema instead of Record<any,ZodType>. The tricky part could be to get the ErrorMessage type working.
Example:
Take, for instance, an app that allows a different set of authentication providers. In such cases, it's crucial to ensure that correlated environment variables are collectively defined. For example, if GOOGLE_CLIENT_ID is provided, it's imperative that GOOGLE_CLIENT_SECRET is also present, and not just marked as optional.
Summary
This issue proposes an enhancement to the current configuration system by allowing the passing of complete Zod schemas, rather than just object structures. This feature aims to provide greater flexibility and precision in validating environment variables, especially in scenarios requiring conditional validations and multiple configurations.
Detailed Explanation
In applications, which deploy to many different environments, with different set of environment variables having more power over the validation process in terms of which env variables are needed together or which should not nether be used together.
Proposed Solution
From what I can tell, this should be as easy as adapting the types to require a
ZodSchema
instead ofRecord<any,ZodType>
. The tricky part could be to get theErrorMessage
type working.Example:
Take, for instance, an app that allows a different set of authentication providers. In such cases, it's crucial to ensure that correlated environment variables are collectively defined. For example, if
GOOGLE_CLIENT_ID
is provided, it's imperative thatGOOGLE_CLIENT_SECRET
is also present, and not just marked as optional.Example schema
Resulting env type
The text was updated successfully, but these errors were encountered: