-
Notifications
You must be signed in to change notification settings - Fork 206
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
Added ValidateAspNetCoreUrls #2466
Conversation
@JerryNixon , you can run |
/azp run |
The failing unit test appears to be caused by stale environment variables from one test causing another to fail due to the new validation, when that test expects the program main function to work. I was able to get the pipeline to pass on another branch (https://github.com/Azure/data-api-builder/tree/dev/aaronburtle/ASP_URL_DEBUGG) by adding in the Environment variable that you are validating to the function in test helper that unsets all DAB environment variables. This is the change that seems to fix it, which also requires that the environment variable constant be moved to the class as a public field so we can borrow its use for testhelper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just needs a small update so all the tests will pass.
/azp run |
/azp run |
/azp run |
This pull request introduces a validation check for the
ASPNETCORE_URLS
environment variable to ensure it is in the correct format before starting the engine in theProgram
class. This change helps in preventing runtime errors due to misconfigured URLs.Key changes:
ValidateAspNetCoreUrls
to check the format of theASPNETCORE_URLS
environment variable. This method splits the environment variable by commas or semicolons and ensures each part is a valid absolute URI.ValidateAspNetCoreUrls
method into theMain
method to validate the URLs before proceeding with the engine start. If the validation fails, an error message is printed, and the application exits with an error code.Why make this change?
The primary motivation is to return a more clear error message to the user.
Closes #2465
What is this change?
Startup validation.
How was this tested?
Sample Request(s)
Valid value in END file:
ASPNETCORE_URLS="http://localhost:5000;https://localhost:5001"
Invalid value in END file:
ASPNETCORE_URLS=http://localhost:5000;https://localhost:5001