Open soullivaneuh opened 4 years ago
This is not currently possible. When the email template is rendered and built we have no way of knowing what URL is accessible to your end users that will receive the email template.
This issue is closed quite quickly. :-/
we have no way of knowing what URL is accessible to your end users that will receive the email template.
Can we make it happen soon or later?
Why not with a file or interface configuration entry? Something configurable on CI jobs.
This is the way I did for my projects, it works very well. :+1:
Perhaps I don't know what you're asking for, but at runtime when we send an email, we do not know the hostname or IP address of resolvable end user address of the server.
Are you looking for a global variable either just for email templates or otherwise so that you don't have to set it in the template itself?
Are you looking for a global variable either just for email templates or otherwise so that you don't have to set it in the template itself?
Exactly, yes! :+1:
I'm aware as email are sent from cli instances, we don't have access to the request variables, as the request does not exist.
What I would like is just to have access to a host
and port
variables related to the FA instance configuration.
I think this way is possible.
In as far as the docker-compose setup there is a variable we need to set = FUSIONAUTH_APP_URL so assumably the value needed for email template host is already stored as a global var in FUSIONAUTH_APP_URL....si?
FUSIONAUTH_APP_URL
is intended for internal use, so ideally it is a private non-routable IP address or hostname in order for one instance of FusionAuth to speak to another.
https://fusionauth.io/docs/v1/tech/reference/configuration FUSIONAUTH_APP_URL The FusionAuth App URL that is used to communicate with other FusionAuth nodes. This value is defaulted if not specified to use a localhost address or a site local if available. Unless you have multiple FusionAuth nodes the generated value should always work. You may need to manually specify this value if you have multiple FusionAuth nodes and the only way the nodes can communicate is on a public network.
Gotit Dan, thanks. I cut my teeth on Parse Server and they had a similar setup param intended solely for email link routes. Fusionauth of course is way more complex so I'll keep my 'suggestions' to myself for now ;)
Ha..
so I'll keep my 'suggestions' to myself for now ;)
No need to do that, all comments are welcome. Happy to help point you in the right direction.
FUSIONAUTH_APP_URL
is intended for internal use, so ideally it is a private non-routable IP address or hostname in order for one instance of FusionAuth to speak to another.
You are right. For example my docker-compose configuration:
DATABASE_URL: jdbc:postgresql://${CI_PROJECT_PATH_SLUG}-db:5432/${DATABASE_NAME}
DATABASE_ROOT_USERNAME: ${POSTGRES_USER}
DATABASE_ROOT_PASSWORD: ${POSTGRES_PASSWORD}
DATABASE_USERNAME: ${DATABASE_USER}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
FUSIONAUTH_APP_MEMORY: ${FUSIONAUTH_MEMORY}
FUSIONAUTH_APP_URL: http://app:9011
SEARCH_SERVERS: http://${CI_PROJECT_PATH_SLUG}-search:9200
On that case, why not creating a another variable like FUSIONAUTH_APP_PUBLIC_URL=http://localhost:9000/
and make it available trough templates?
@soullivaneuh I think you're looking for something like this? https://github.com/FusionAuth/fusionauth-issues/issues/88
I think we need some extra param global.host=https://auth.mysite.com
And links can be like ${global.host}/email/verify/${verificationId}?tenantId=${user.tenantId} convert to
https://auth.mysite.com/email/verify/${verificationId}?tenantId=${user.tenantId}
Because otherwise we need to hardcode domain in each template and translation. If domain will change, we need to edit each template
Thanks
I just came across this problem myself. So is it really the case that you have to manually edit every template to change all the hostnames? Do people do this for every environment?
Yes, for now you could use the API or the UI to update these references. We don't currently know the public URL except when we are servicing an HTTP request.
So until we deliver this https://github.com/FusionAuth/fusionauth-issues/issues/88 or some similar feature to define a public variable of where your FusionAuth instance is running you'll need to update the values in the templates.
This step is likely just a one time thing, is managed via an API or a kickstart configuration so while perhaps painful the first time around, it is likely not a common workflow to change them.
We just ran into this as well, and frankly I'm a bit surprised that a complex system like FusionAuth doesn't use a global property that I'd change once and would impact every email where that global property token is used. The initial value of that global property could even be what you have hard-coded in the emails.
Thanks for your feedback, @ryaneastabrook !
If this is important to you, please make sure to upvote this issue, as we take that community feedback into account when planning future work.
would also be very interesting to get this feature
@skirem please make sure you upvote the issue as that impacts our roadmap.
Email template: host/port variable?
Description
I'm working on email template design. The template are stored in files and will be deploy automatically. In a nutshell, we don't want to use interface to edit templates.
Considering this template:
I see the app URL is "hard-coded". Can we get a way to configure the host and the port once (perhaps in fusionauth.properties or in the UX) and expose that in all the email templates?
Related
How to vote
Please give us a thumbs up or thumbs down as a reaction to help us prioritize this feature. Feel free to comment if you have a particular need or comment on how this feature should work.