Different base resources for an environment
-
If I want to host my CSS and images on a different hostname for each environment, how can I do so?
So for dev, I want all these to be pulled from dev.example.com. For prod from prod.example.com, and so on.
What is the best way to do this?
-
The best way to do this is to put a value on the
tenant.dataobject. From there you can access it in each theme.So, for the tenant in the dev environment, set
tenant.data.assethosttodev.example.com. For the prod environment, settenant.data.assethosttodev.example.com.Then, in your theme, you'd have something like this:
<link rel="stylesheet" href="${tenant.data.assethost}/styles.css"/>The reason to use the
tenantobject is that it is available on every theme template.This does mean that your tenant configuration will differ slightly between environments. You can also replicate this field value between tenants if you are using multiple tenants.