Skip to content

Conversation

@gadomski
Copy link
Member

@gadomski gadomski commented Nov 17, 2025

Description:

This re-enables the use of simple,comma,delimted,strings from environment variables for CORS_ORIGINS. Otherwise, the env var syntax needs to be an encoded json string, which is awkward.

E.g. without this fix you had to say CORS_ORIGINS=["http://a.test","http://b.test"]. Now you can say CORS_ORIGINS=http://a.test,http://b.test, which is how it's described in the CHANGELOG.

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the CHANGELOG.

Otherwise, the env var syntax needs to be an encoded json string, which
is awkward.
@gadomski gadomski self-assigned this Nov 17, 2025
@gadomski gadomski marked this pull request as draft November 17, 2025 14:25
@gadomski
Copy link
Member Author

Marking as draft, as we might have to do this to CORS headers as well.

@vincentsarago
Copy link
Member

From pedantic settings doc

Complex types like list, set, dict, and sub-models are populated from the environment by treating the environment variable's value as a JSON-encoded string.

The fact that this lib used to support this is IMO not great and I would think that we should avoid this.

That's said in

if ext := os.environ.get("ENABLED_EXTENSIONS"):
enabled_extensions = set(ext.split(","))

we only support , delimited string so I'll ✅ this PR for now but we might revisit this in the future

@gadomski gadomski marked this pull request as ready for review November 20, 2025 12:11
@gadomski gadomski merged commit 72b9107 into main Nov 20, 2025
8 checks passed
@gadomski gadomski deleted the fix-cors-origins branch November 20, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants