commit | 9b5bc808ae2064a739368177bfbd15fc32681077 | [log] [tgz] |
---|---|---|
author | Andreas Schaefer <schaefa@iMac.local> | Fri Jan 17 09:21:08 2020 -0800 |
committer | Andreas Schaefer <schaefa@iMac.local> | Fri Jan 17 09:21:08 2020 -0800 |
tree | 0ee149d66aefec4f20c9b4b8cfea53cedffd0bd5 | |
parent | 96ebac403be49e904ca24e0aad401fcf81f41932 [diff] | |
parent | 4f48deeddde060447cdcd00730263a9cb8e9ae6d [diff] |
Merge branch 'master' into feature/SLING-7768
This module is part of the Apache Sling project.
This bundle provides the Resource Resolver and Resource Resolver Factory
Setting up ETC Mappings (/etc/map) for different instances like dev, stage, qa and production was time consuming and error prone due to copy-n-paste errors. As a new feature Sling now supports String Interpolation in the /etc/map. With it it is possible to create a single set of etc-mapping and then adjust the actual values of an instance by an OSGi configuration. By default a variable name is enclosed in ${} with a $ as escape character and no in-variable-substitution. All of that is configurable together with the actual value map.
The Substitution Configuration can be found in the OSGi Configuration as Apache Sling String Interpolation Provider. The property Placeholder Values takes a list of key=value entries where each of them map a variable with its actual value. In our little introduction we add an entry of phv.default.host.name=localhost. Save the configuration for now. Before going on make sure that you know Mapping Location configuration in the OSGi configuration of Apache Sling Resource Resolver Factory. Now to to composum and go to that node. If it does not exist then create one. The mapping should look like this:
Opening the page http://localhost:8080/starter/index.html should work just fine.
Now got back to the String Interpolation configuration and change the value to qa.author.acme.com and save it.
For local testing open your hosts file (/etc/hosts on Unix) and add a line like this:
127.0.0.1 qa.author.acme.com
save it and test with ping qa.author.acme.com
to make sure the name resolves. Now you should be able to open the same page with: http://qa.author.acme.com/starter/index.html.
Now do the same with phv.fq.host.name=staging.author.acme.com.
The String Interpolation works with any part of the etc-map tree.