-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add a class that validates whether the keys required by the application exist in the current environment #42
Comments
MrDave1999
changed the title
Add support for requesting required keys
Add support for requesting certain keys to be required by the application
Feb 20, 2022
MrDave1999
changed the title
Add support for requesting certain keys to be required by the application
Add a class that validates whether the keys required by the application exist in the current environment
Feb 22, 2022
MrDave1999
added a commit
that referenced
this issue
Feb 24, 2022
…tion exist in the current environment (issue #42)
MrDave1999
added a commit
that referenced
this issue
Feb 24, 2022
MrDave1999
added a commit
that referenced
this issue
Feb 24, 2022
MrDave1999
changed the title
Add a class that validates whether the keys required by the application exist in the current environment
Add a interface that validates whether the keys required by the application exist in the current environment
Mar 2, 2022
MrDave1999
changed the title
Add a interface that validates whether the keys required by the application exist in the current environment
Add a class that validates whether the keys required by the application exist in the current environment
Mar 6, 2022
MrDave1999
added a commit
that referenced
this issue
Mar 6, 2022
MrDave1999
added a commit
that referenced
this issue
Mar 6, 2022
MrDave1999
added a commit
that referenced
this issue
Mar 6, 2022
MrDave1999
added a commit
that referenced
this issue
Mar 6, 2022
MrDave1999
added a commit
that referenced
this issue
Mar 16, 2022
MrDave1999
added a commit
that referenced
this issue
Mar 16, 2022
…inciple of Least Astonishment (issue #42)
MrDave1999
added a commit
that referenced
this issue
Mar 16, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The idea of this new feature is to be able to request that certain keys are required by the application, in case they do not exist in the current environment, an error is generated.
Example:
In the above example we first load the .env file and set the variables, then we call the
Validate
method to validate if the required keys exist in the current environment, otherwise an exception is thrown.In other words, after calling the
Load
method, it will check if the keys "SERVICE_APP_ID", "SERVICE_KEY", "SERVICE_SECRET" exist in the environment of the current process.You can also ignore the exception and handle the error in another way:
You can also represent the required keys in a class and use each property as a key, for example:
The text was updated successfully, but these errors were encountered: