Commandbox cfconfig import with env substitution?

I need help with Commandbox cfconfig command…apologies if this is the wrong forum…

I’m working on containerizing our lucee app, but running into problems with dynamic configuration.

I’m using the official lucee image: lucee/lucee:5.4-nginx as a base. I’ve installed commandbox onto the image using the apt-get instructions here: Installation - CommandBox : CLI, Package Manager, REPL & More

I’ve got a lucee server config json file that I created from my dev server using box cfconfig export fromFormat=LuceeServer@5 to=server.json from=...
I’m passing the json file into the container using the docker compose configs directive.
On container startup, I’m running box cfconfig import ... before starting up tomcat…

This all works great.

However, on my dev box, my datasource needs to be set to a host on my local network, but for production, I’ll need to use a container service that is defined in docker-compose.yaml. So, I’m passing environment variable: MSSQL_HOST.

Now I cannot figure out a way to substitute the value of ${MSSQL_HOST} into the server.json file when I import it with box cfconfig import. In the following situation, the server.json file has the datasource host set to “db” by default. My container is started with env MSSQL_HOST=yojimbo.local

I’ve tried:

$ box cfconfig import \
toFormat=LuceeServer@5 \
from=/server.json \
to=/opt/lucee/server/lucee-server \

but I get an error:
You can only use "replace" when your "to" destination is JSON.

If I write out to an intermediate json file, I get:


This looked promising, but when I import from that json file, the hostname is still set to “db”

This is confusing…I would expect that, if the env substitution failed, I would get the literal value: “${MSSQL_HOST}” for the hostname, but instead, it seems as though it’s silently ignoring the host value entirely.

Now, I could just use separate json config files for my dev and production environment, but I’m trying to minimize duplication…for now, the only difference between the environments is the db server host, but I may end up needing to parameterize other values, and the idea of multiple lucee config files in addition to multiple docker-compose files just leaves a bad taste in my mouth.

Commandbox says it supports environment variables…am I just doing it wrong?


OS: Ubuntu 22.04
Java Version: 11.0.21
Tomcat Version: 9.0.83
Lucee Version: