Closed alan910127 closed 10 months ago
Isn't a simple export const envs = process.env as Env
be fine enough?
I think there are some validations inside the logic right now (e.g. check for null
), if we simply use type assertions, it might be pretty easy to forget to check them.
Only GITLAB_TOKEN
env is required and well documented, I don't think that worth a validation.
If you think the type of environment variables is nice to have, I can go and implement it with option 1. 😄
Sure, thanks for doing this!
Description
Currently, environment variables are used in several places in the project to determine the behavior. However, it might be unclear for developers who are new to this codebase whether an environment variable is defined or not. It should be helpful to have an exported
env
variable with the "actual" types for the variables or even with pre-validation.Proposed Solution
We could either use:
zod
to validate the environment variables and export the object.