richard.herbert
02/08/2023, 3:33 PMCFConfig
with ModCFML, can the web context .cfconfig.json file just be the differences wanted between the server context and the particular web context or do that have to be a full overwrite of the config?richard.herbert
02/08/2023, 3:42 PMbdw429s
02/08/2023, 4:23 PMbdw429s
02/08/2023, 4:24 PMbdw429s
02/08/2023, 4:24 PMbdw429s
02/08/2023, 4:25 PMbdw429s
02/08/2023, 4:25 PMbdw429s
02/08/2023, 4:25 PMrichard.herbert
02/08/2023, 4:31 PMbdw429s
02/08/2023, 4:32 PMSo if I have a web context .cfconfig file, any config in there, however little (say just DSNs and mappings) would be additive or overwrite based on name.Again, it depends on whether you're asking a question about how CFConfig imports or how Lucee works.
bdw429s
02/08/2023, 4:33 PMrichard.herbert
02/08/2023, 4:41 PMit depends on whether you’re asking a question about how CFConfig imports or how Lucee works.I guess my better question is, how does CFConfig control the Lucee configuration? From your two phases, CommandBox reads the cfconfig at startup and writes the XML that Lucee then reads in when it starts up. So on the first round, CommandBox then Lucee, Lucee will reflect the cfconfig settings. If I then stop Lucee, make a cfconfig file change and start Lucee back up again, I won’t see that change to the cfconfig in the running Lucee. Does that sound right?
bdw429s
02/08/2023, 4:42 PMrichard.herbert
02/08/2023, 4:42 PMbdw429s
02/08/2023, 4:43 PMhow does CFConfig control the Lucee configuration?It writes to XML files. CFConfig's import will be a complete override of "complex" things such as DNSs, mail servers, or caches unless you've used the
--append
flag in which case it isn'tbdw429s
02/08/2023, 4:44 PM. If I then stop Lucee, make a cfconfig file change and start Lucee back up again, I won’t see that change to the cfconfig in the running Lucee. Does that sound right?No, that sounds wrong. CFConfig's automatic settings import fires on the
onServerStart
interceptor in CommandBox so it re-imports every time the server starts. I would expect your changes in the JSON files to be represented in the server after starting it.bdw429s
02/08/2023, 4:45 PM.cfconfig.json
convention. You can manually import config any time you like with the
cfconfig import ...
command. And, depending on your Lucee settings around watching config files for changes, those changes may or may not be immediately picked up by the running server.bdw429s
02/08/2023, 4:47 PMdatasources
key in your JSON, CFConfig won't touch the DSNs.
• Overwrites (again, unless you've used the --append
flag) all config which is present in the JSON. So if there IS a datasources
key in the JSON, then that list of DSNs will be all that is left in the XML once CFConfig is done (all others are removed)
• writes the XML file back outbdw429s
02/08/2023, 4:48 PM{
"adminpassword": "foo"
}
then the entire XML file would remain untouched except for the admin passwordbdw429s
02/08/2023, 4:52 PMDoes the addition of ModCFML confuse matters, I assume not.It depends on how easily confused you are 😉 CFConfig has a mechanism to preload any number of lucee web contexts with config, but it's not clear from your question if or how you are using those features. https://cfconfig.ortusbooks.com/using-the-cli/commandbox-server-interceptors/server-start#modcfml-support-for-lucee-contexts
In which case I need to look closer at why this server is not respecting the context specific cfconfig file. Maybe I’ve got my path to the context specific cfconfig file wrong?Maybe, hard to say without seeing much more of your setup.
bdw429s
02/08/2023, 4:57 PMbdw429s
02/08/2023, 4:58 PM--dryRun
start and then confirm if the right config is in the right context from the CLI with the cfconfig show ...
commandbdw429s
02/08/2023, 5:02 PMcfconfig show fromFormat=luceeweb-/path/to/site1/
cfconfig show fromFormat=luceeweb-/path/to/site2/
richard.herbert
02/08/2023, 5:17 PMimport will be a complete override of “complex” things such as DNSsAssumed.
settings import fires on theThat was my assumption but not the experience of one of our devs, hence my attempt to understand the flow.onServerStart
You can manually import config any time you likeI hadn’t thought about that but I guess that’s just like making changes directly in the Lucee Admin.
So back to the append/overwrite bit. CFConfig does thisThat was my assumption.
if you had a JSON file with just a single settingAlso my assumption.
CFConfig has a mechanism to preload any number of lucee web contexts with configYes, I can easily get confused 👴 but I did quote that link in my original question and that’s the situation I am in - using ModCFML
start by analyzing the console output of the server when startingYes, I did look at that and it looks as I would expect although this is on a colleagues machine but I will look closer. Of course “_it works on my machine_” but there are enough differences to cause some doubt.
Do aThat’s good idea, I’ll certainly be trying that. Thanks @bdw429s, I’ll work through those ideas tomorrow and report back.start and then confirm if the right config is in the right context from the CLI with the--dryRun
commandcfconfig show ...
bdw429s
02/08/2023, 5:18 PM