Skip to content
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

Allow env var with no name in dashboard #5323

Merged
merged 4 commits into from
Aug 16, 2024
Merged

Allow env var with no name in dashboard #5323

merged 4 commits into from
Aug 16, 2024

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 16, 2024

Description

The dashboard was crashing because a user had an env var on their machine with no name.

This PR changes the dashboard to allow env var with no name in dashboard. Not ideal, but better than crashing, or losing data.

Fixes #5309

Can reproduce empty env var via:

builder.AddProject<Projects.MyFrontend>("frontend")
       .WithExternalHttpEndpoints()
       .WithReference(basketService)
       .WithReference(catalogService)
       .WithEnvironment(c =>
       {
           c.EnvironmentVariables[""] = "hi";
       });

Note that resource is created by DCP but fails to start. I'm going to create a follow up issue to validate env vars set by the model always have a key. That way the host fails with a good error message before the DCP or dashboard start. Note that still doesn't stop an empty name env var from the OS.

Update: #5324

image

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
      • Link to aspire-docs issue:
    • No

@adamint adamint merged commit 0ffae5a into main Aug 16, 2024
11 checks passed
@adamint adamint deleted the jamesnk/empty-envvar branch August 16, 2024 16:30
@github-actions github-actions bot locked and limited conversation to collaborators Sep 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard crashes: The value cannot be an empty string or composed entirely of whitespace. (Parameter 'name')
2 participants