1

Using Qute with templates from a database

 1 year ago
source link: https://quarkus.io/blog/qute-templates-from-db/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Introduction

I’m part of a Red Hat team that created a multitenant notifications service which sends the notifications from many Red Hat Hybrid Cloud Console apps (the tenants). Our service can be used to send several kinds of notifications, including emails. Each tenant can create as many email templates as they need and link them with the events that will trigger the notifications.

We implemented that with the amazing Qute templating engine and templates stored as files in the src/main/resources/templates folder. It allowed our tenants to design templates tailored to fit their needs with minimal knowledge of Qute. However, we quickly realized that editing the templates was a slow and heavy process for the tenants. Indeed, they had to create a GitHub pull request in our repository, wait for a review and then wait again for a deployment before the templates could be tested. We needed to make that process easier for the tenants, ideally even self-serviced.

Then we decided to move the templates from the file storage to a database using Qute’s TemplateLocator. It helped us offer the tenants an easier, frictionless and self-serviced way of editing the templates.

before after

Here’s how we did it.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK