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

Remove dependency on before_first_request #500

Closed
fluffy-critter opened this issue Nov 24, 2022 · 1 comment · Fixed by #517
Closed

Remove dependency on before_first_request #500

fluffy-critter opened this issue Nov 24, 2022 · 1 comment · Fixed by #517
Labels
code quality Places where the code quality or readability can be improved large This is going to take a lot longer than most things performance Issues pertaining to performance (both CPU and RAM) security Critical issues regarding the security of Publ and the server it runs on

Comments

@fluffy-critter
Copy link
Collaborator

Flask's before_first_request function is going away. Publ currently uses it to bootstrap Authl's configuration at startup time in a user-friendly way; Authl's configuration requires that the Flask app be fully-formed (so that the secret_key property is available) but that it not yet be serving up any requests (so that authl.flask can add the _login and _logout routes).

There are three paths forward, both fraught with peril:

  1. Add a finalize_setup method to the Publ application object that runs the previous before_first_request functionality
  2. Refactor Publ to once again be a library that spawns a standalone Flask app rather than inheriting from it
  3. Have Publ roll its own Authl routes, rather than using authl.flask

Option 2 is the best long-term one, but that was the original design to Publ, and I changed it to be inheritance-based rather than compositional for some reason that I can't recall (probably something to address issues with startup order and PonyORM's global state, but who even knows anymore).

Option 1 is definitely the easiest to do, though, and could probably be done as an expedient option in advance of Flask 2.3.

@fluffy-critter fluffy-critter added code quality Places where the code quality or readability can be improved performance Issues pertaining to performance (both CPU and RAM) large This is going to take a lot longer than most things labels Nov 24, 2022
@fluffy-critter fluffy-critter added the security Critical issues regarding the security of Publ and the server it runs on label May 2, 2023
@fluffy-critter
Copy link
Collaborator Author

Now that Flask 2.3 is a required update this should be done ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Places where the code quality or readability can be improved large This is going to take a lot longer than most things performance Issues pertaining to performance (both CPU and RAM) security Critical issues regarding the security of Publ and the server it runs on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant