Skip to content

Core: Accept REST auth configuration from environment variables - #4451

Open
Anurag-S1ngh wants to merge 2 commits into
apache:mainfrom
Anurag-S1ngh:fix/3422-rest-auth-config
Open

Anurag-S1ngh wants to merge 2 commits into
apache:mainfrom
Anurag-S1ngh:fix/3422-rest-auth-config

Conversation

@Anurag-S1ngh

Copy link
Copy Markdown
Contributor

Rationale for this change

Catalog configuration from environment variables arrives as flat strings, so a JSON encoded auth value was treated as an object. _create_session() then called .get() on a string and failed with AttributeError.

Parse the auth configuration from three shapes: an object (unchanged), a JSON string, and flattened auth.type / auth.<type>.<param> keys. Dashed option names such as client-id are normalized to the constructor's snake_case names. Invalid JSON and non-object values raise a clear ValueError.

Are these changes tested?

Yes. New tests in tests/catalog/test_rest.py cover a JSON string, flattened keys, dashed key normalization, and invalid JSON. tests/catalog/test_rest.py passes.

Are there any user-facing changes?

Yes. REST catalogs can be configured through PYICEBERG_CATALOG__<NAME>__AUTH environment variables as described in the issue.

Configuration from environment variables arrives as flat strings, so a
JSON encoded auth value was treated as an object and failed with
AttributeError. Decode JSON strings, merge flattened auth.* keys, and
normalize dashed option names before the auth manager is created.

This branch has not been deployed

No deployments
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.

1 participant