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

Extra warnings about beaker.session.secret not being declared #8467

Closed
amercader opened this issue Oct 1, 2024 · 0 comments · Fixed by #8468
Closed

Extra warnings about beaker.session.secret not being declared #8467

amercader opened this issue Oct 1, 2024 · 0 comments · Fixed by #8468
Assignees

Comments

@amercader
Copy link
Member

CKAN version: current master (2.12+) and 2.11

After merging #7853 we get a lot of these warnings:

2024-10-01 14:04:08,560 WARNI [ckan.common] Option beaker.session.secret is not declared
2024-10-01 14:04:08,674 WARNI [ckan.common] Option beaker.session.secret is not declared
2024-10-01 14:04:08,823 WARNI [ckan.common] Option beaker.session.secret is not declared
2024-10-01 14:04:08,911 WARNI [ckan.common] Option beaker.session.secret is not declared
2024-10-01 14:04:08,929 WARNI [ckan.common] Option beaker.session.secret is not declared
2024-10-01 14:04:09,014 WARNI [ckan.common] Option beaker.session.secret is not declared
2024-10-01 14:04:09,032 WARNI [ckan.common] Option beaker.session.secret is not declared

SECRET_KEY uses configured_default("beaker.session.secret",None) to fallback to the legacy secret key setting, but it is no longer defined in the config declaration, so when configured_default tries to access it a warning is shown.

Perhaps a better approach is to use legacy_key: beaker.session.secret on SECRET_KEY which will try to use the beaker setting if SECRET_KEY is not present, and display a deprecation warning

2024-10-01 14:11:23,684 WARNI [ckan.config.declaration] Config option 'beaker.session.secret' is deprecated. Use 'SECRET_KEY' instead
@amercader amercader changed the title Extra warnings about beaker.session.secret is not being declared Extra warnings about beaker.session.secret not being declared Oct 1, 2024
amercader added a commit that referenced this issue Oct 2, 2024
Use `legacy_key` instead of `configured_default` to avoid a non-declared
warning.

Note that the fallback to `beaker.session.secret` will only work if
`SECRET_KEY` is not present at all. If it is present but empty a non-empty
error will be shown.
amercader added a commit that referenced this issue Oct 2, 2024
wardi added a commit that referenced this issue Oct 3, 2024
github-actions bot pushed a commit that referenced this issue Oct 3, 2024
Use `legacy_key` instead of `configured_default` to avoid a non-declared
warning.

Note that the fallback to `beaker.session.secret` will only work if
`SECRET_KEY` is not present at all. If it is present but empty a non-empty
error will be shown.

(cherry picked from commit bd77bda)
github-actions bot pushed a commit that referenced this issue Oct 3, 2024
(cherry picked from commit 0ae06ff)
amercader added a commit that referenced this issue Oct 3, 2024
[Backport dev-v2.11] [#8467] Use legacy_key in SECRET_KEY fallback
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 a pull request may close this issue.

1 participant