You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
I'm setting up a task queue system to send emails to newly-registered users to validate that they own their email address. However, these emails need to contain a link back to the running application, which means that the job needs to know what domain/port the application is running on. I'm thinking that the best way to do that would be to encode that information into the job payload, which means that the Postgres trigger function needs to know this information.
We're already using pgSettings to set the user_id, so I figure that we could do the same thing for setting the domain, based on the value of httpServer.address(). I'm just not sure of the best way to do this, or whether it belongs in the jwt namespace or elsewhere. Hence, I'm filing this issue! Can I please get some guidance here?
The text was updated successfully, but these errors were encountered:
After some further research, I'm thinking it might be best to implement a sites table in the database, similar to Django's "sites" framework. Does that seem reasonable?
In other apps I use the https://github.com/graphile/worker using the same envvars as the main application, which has the ROOT_URL envvar available so it knows where to link to:
I'd advise this approach, it also means that if the user visits the application on the wrong host (e.g. missing www, forgot https://, etc) the email will link to a consistently correct place.
I'm setting up a task queue system to send emails to newly-registered users to validate that they own their email address. However, these emails need to contain a link back to the running application, which means that the job needs to know what domain/port the application is running on. I'm thinking that the best way to do that would be to encode that information into the job payload, which means that the Postgres trigger function needs to know this information.
We're already using
pgSettings
to set theuser_id
, so I figure that we could do the same thing for setting the domain, based on the value ofhttpServer.address()
. I'm just not sure of the best way to do this, or whether it belongs in thejwt
namespace or elsewhere. Hence, I'm filing this issue! Can I please get some guidance here?The text was updated successfully, but these errors were encountered: