What I did
I was editing the stock .CFConfig.json directly (stopped Tomcat first, edited the file, then started Tomcat again).
I added things like:
mailServers
caches (Redis)
What happened
Every time I restarted Tomcat:
My changes were silently removed
The file reverted to an older version
No errors in logs
configReadOnly=true did not help
File permissions were fine
It looked like Lucee simply ignored my edits and regenerated the file when tomcat restarted.
What fixed it
I created this file: WEB-INF/lucee-server/deploy/.CFConfig.json
and put only my new config (mailServers, redis, etc.) in there.
After restarting:
Lucee merged it into the main .CFConfig.json
My changes finally persisted
The file stopped reverting
Conclusion
It seems like:
In Lucee 7, editing .CFConfig.json directly may not persist unless a deploy config exists.
This behavior:
isn’t obvious
isn’t documented clearly
makes it look like your edits “don’t work”
is especially confusing if you’re trying to manage config via files instead of UI
Question
Is this expected behavior in Lucee 7?
If so, is the deploy .CFConfig.json required for persistence?
I’d personally like to be able to just drop my changes directly into the main file when I’m developing. I understand when in production and deploying, it might be easier to keep a drop in file that I place in the deploy folder, but even then, its confusing because I can edit the main .CFConfig.json file just fine after the initial deploy file is pushed in.
The cfadmin / configImport / APIs manages runtime state, making changes and persisting them
After startup, the master runtime config is in memory and written out to disk as updated via the APIs, which is probably why your edits are disappearing as Lucee doesn’t know about them.
Dropping a CFConfig.json in deploy maintains this state
If you want to edit your .CFConfig.json manually you need to stop the server, make changes and then start it up.
There is an option to monitor CFConfig.json for changes, YMMV
That’s what I figured, and that works for me, but only after I force an update to the default file by dropping in a file to /deploy. So stopping the server to edit the file doesn’t work initially.
I’ll try and explain it better…the issue I was facing was that even with stopping the server, making changes to .CFConfig.json, and starting it back up, changes weren’t sticking until only after I forced an update from the stock file to something different with the a 2nd /deploy config file, if that makes sense.
assume stock .CFConfig.json
stop server
edit .CFConfig.json manually
start server
changes to file vanish
next step
stop server
place custom .CFConfig.json in /deploy
start server
lucee merges deploy file to main file
changes stick
then repeat first step
assume stock .CFConfig.json w/ a deploy file merged into it
stop server
edit .CFConfig.json manually
start server
changes stick this time
So it seems like the stock .CFConfig.json file can’t be edited manually until /deploy merges something into it, then after that it can be edited like expected.
not a show stopper issue at all, just a bit of a quirk that threw me for a loop for a while because I jumped right into wanting to edit the file manually
Anything in the out / err / deploy logs? out and err are the initial startup logs, before the config has been loaded and log4j is configured / available
any .buggy files? it sounds like your edited file is possibly invalid and being rejected?
Is you custom file identical to the result of an update via deploy
Which exact version of Lucee 7 are you using?
Over on testlab, I have a series of integration tests for all this
(Alas slightly out of date as some of them are tied to checking the ext versions at the time I was last working on them)
I had a similar issue with Lucee 7. I think if .cfconfig.json has an invalid entry in it, it will load a default version in it’s place on reboot. I noticed this because some of my settings from a Lucee 6 server had to be removed from .cfconfig.json before being able to apply it to a Lucee 7 server successfully. The server would overwrite the file on reboot until I fixed the issues. I may be mistaken about this, but I thought that’s what was happening.
By the way, this is the server I tried apply the Lucee 6 file to and had the issues:
Lucee 7.0.1.100
Apache Tomcat 11.0.15
Windows Server 2019 (10.0) 64bit
JRE 21.0.9 (Eclipse Adoptium) 64bit
I removed about half the JSON in the file and got it to load correctly. However, adding in the remain part was tedious. So I created a new .cfconfig.json by going into the admin portal with a default .cfconfig.json loaded and setting the settings by hand in the admin portal.