Possible to Access Environment Variables from XQuery?
I’m running BaseX in a Docker container started via docker-compose. I need to communicate some local configuration details to BaseX. Can set these as environment variables (e.g., using .env with docker-compose) but I don’t see anything in the docs that would let me access environment variables from XQuery. Is there a built-in way to do this? Thanks, Eliot -- Eliot Kimber http://contrext.com
Hi Eliot, fn:environment-variable should do the job; proc:property [1] can be used to access system properties. Hope this helps, Christian [1] http://docs.basex.org/wiki/Process_Module#proc:property On Sat, Mar 25, 2017 at 7:01 PM, Eliot Kimber <ekimber@contrext.com> wrote:
I’m running BaseX in a Docker container started via docker-compose. I need to communicate some local configuration details to BaseX. Can set these as environment variables (e.g., using .env with docker-compose) but I don’t see anything in the docs that would let me access environment variables from XQuery.
Is there a built-in way to do this?
Thanks,
Eliot
-- Eliot Kimber http://contrext.com
Thanks—it never occurred to me this would be a built-in function of XQuery 3. Cheers, E. -- Eliot Kimber http://contrext.com On 3/25/17, 7:05 PM, "Christian Grün" <christian.gruen@gmail.com> wrote: Hi Eliot, fn:environment-variable should do the job; proc:property [1] can be used to access system properties. Hope this helps, Christian [1] http://docs.basex.org/wiki/Process_Module#proc:property On Sat, Mar 25, 2017 at 7:01 PM, Eliot Kimber <ekimber@contrext.com> wrote: > I’m running BaseX in a Docker container started via docker-compose. I need to communicate some local configuration details to BaseX. Can set these as environment variables (e.g., using .env with docker-compose) but I don’t see anything in the docs that would let me access environment variables from XQuery. > > Is there a built-in way to do this? > > Thanks, > > Eliot > > -- > Eliot Kimber > http://contrext.com > > > >
Hi Eliot, Try the XPath function fn:environment-variable [1] /Andy [1] https://www.w3.org/TR/xpath-functions-31/#func-environment-variable On 25 March 2017 at 18:01, Eliot Kimber <ekimber@contrext.com> wrote:
I’m running BaseX in a Docker container started via docker-compose. I need to communicate some local configuration details to BaseX. Can set these as environment variables (e.g., using .env with docker-compose) but I don’t see anything in the docs that would let me access environment variables from XQuery.
Is there a built-in way to do this?
Thanks,
Eliot
-- Eliot Kimber http://contrext.com
participants (3)
-
Andy Bunce -
Christian Grün -
Eliot Kimber