-
Notifications
You must be signed in to change notification settings - Fork 43
Add an example for using auth for logging in #174
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
Conversation
This will require adding a postgres database to the CI and calling the database creation and migration commands. I can add that to the CI configuration, once I read up a bit on https://docs.github.com/en/actions/use-cases-and-examples/using-containerized-services/creating-postgresql-service-containers |
If this is not desired, I can also just paste the code into the documentation, in the middware auth section. |
Looking at https://github.com/marketplace/actions/setup-postgresql-for-linux-macos-windows since the CI system uses all three platforms |
@sc68cal Nice, this looks good. Feel free to push changes to add postgres, I've been wanting to have database coverage in the demo app for a while now. |
I'm running it locally and hitting an issue with the tests where they fail on a PG error.
The error from PG is
Now, I am running |
Ok, so running it with 200 max connections gets it down to only 4 tests fail with too many connections error but that's a lot of connections. Does
|
Tests pass if the postgres container gets configured with That's a lot of connections. |
Discovered |
I always mess this up when moving from shell to YAML configs
Let jetzig create it via the commands
All this code is extracted from an actual project I am building with I will add some tests that creates a user and exercises the |
And why yes, I was coding at |
OK. I'm at a good stopping point here, at least for this PR. I am perfectly fine with this being squashed into a single commit, or I can respin this PR to combine the commits into a more logical sequence if required. I have some lingering concerns around |
This allows us to use database.zig for CI, while still creating a blank database.zig for new projects that are created via jetzig init
@sc68cal I'm going to get this merged this weekend ! Thank you for all the work you've done on it so far. ❤️ |
Adjust test, fix memory leak in hashPassword, deinit repo on test app…
Nice ! Finally we have database coverage in CI. |
This adds a small example for using authentication and signing in a user. This will be linked to from the jetzig.dev documentation, for how to use the authentication middleware