for creating a user with elevated privileges.
For ktor, I have resorted to creating a user programmatically when the app starts, (first checking if the user already exist)
or going into the database and adding the user manually, but this doesn't scale when you constantly need to clear the db in development
Is there a more elegant or standard way of doing this?
I assume it would be a similar process in other frameworks, express, flask etc since they don't also have that
a
AdamW
04/30/2024, 9:52 PM
There are no users in Ktor by default - so not really. But why doesn’t your solution scale if you’re checking that the user already exists?
r
Rudy Sulley
04/30/2024, 9:53 PM
Doing it manually in the database is what doesn't scale when the db is cleared occasionally, ie in tests
Rudy Sulley
04/30/2024, 9:54 PM
i would like to know what methods are usually employed for this use case
a
AdamW
04/30/2024, 10:14 PM
There’s no such thing for Ktor specifically. I just reset and initialize the database between each test in a listener, works for me.