Using Postgres in Docker with Hanami

I have started to move my database dependencies into Docker, because this makes it so mach easier and cleaner to deal with different database versions for different applications. To get this to work as smoothly as possible with Hanami, I have written down this step by step guide, so you can follow along at home.

[Read more]

Using dry-effects to implement current_account

After switching to rodauth I was not quite happy with my implementation of the current_account feature. So I decided to dig a bit deeper into the documentation and found a really neat solution.

I was already using dry-effects, but in a rather haphazard way. Looking at the documentation again, I decided to go the rack middleware route as well. If I put the new middleware after rodauth, I can grab the account_id from request.env[“rodauth”] and store it in the effects handler:

[Read more]

Migrating Hanami from Warden to Rodauth

I recently migrated a small app that I wrote to help me track ADHD symptoms from a very basic authentication with Warden to a rodauth based solution.

I am a big fan of rodauth, as it has the same design sensibilities as Jeremy’s other awesome gems, roda and sequel.

Since switching authentication systems is a bit trickier than adding one from scratch I thought it might be helpful to compile some of my notes for others who are planning to go on this journey.

[Read more]

Testing rodauth in Hanami request specs

This has taken me longer to figure out than it should, so I am writing this down in the hopes of saving other people some time and headache.

TLDR

use env "rack.session", {account_id: account.id} before issuing any other Rack::Test methods, and it just works.

[Read more]