Search code examples
orbeon

Is it possible to use environment variables in Orbeon service URLs?


For example, in our Orbeon test environment we'd like the service URL to be: https://test.some-endpoint.com/validate.

Then when the form is deployed in the production environment, the service URL should automatically change to: https://prod.some-endpoint.com/validate.

I recognize that I could create a hidden field to store the environment value, but this wouldn't automatically change when the form is deployed in the production environment. See screenshot:


Solution

  • Starting with Orbeon Forms 2020.1, you can use the environment-variable('SERVICE_HOST') function. So, assuming you have a environment variable named SERVICE_HOST, in the HTTP Service Editor you can use the following for the Resource URL:

    https://{environment-variable('SERVICE_HOST')}.some-endpoint/validate