[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Using Environment Variables within context.xml - Tomcat 8 Source 2 Image


I was wondering if it is possible to achieve the following:

We have created a Geoserver web app using the Tomcat 8 source to image file, however we require this app to connect to 3 external databases to retrieve the spatial data.

To build our application we are using the Jenkins S2I and have created a build pipeline that will build, deploy and promote the application through various stages eg dev, test, prod.

Using the Tomcat Source 2 Image the app has been created and the war file gets deployed along with the context.xml file specific for the application, which if we hardcode all the values in the context.xml file this will work for an individual environment.

I have read that it was possible in OS version 2 to substitute the values in the context.xml file with environment variable within OS however this does not seem to work.

What we have is

context xml

<Resource name="${MAPPING_JNDI}"
                     url = ""


<Resource name = "${OSMAP_JNDI}"
                     url = ""

In the deploy template we have these values configured as environment variable as such

- name: "MAPPING_JNDI"
  value: ${MAPPING_JNDI}

where the values are read in from a properties file.

If I use the terminal to inspect the pod I can see that the environment variable are all set correctly, however the JNDI lookup fails as the values have not been substituted. Is it possible to do this.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]