Docker, CommandBox, CFConfig and Web Password

Docker, using cfconfig .json file. Once I straightened out the datasource issues, I stumbled into a password issue I can’t solve.

I 100% know that the .json file is getting loaded into the Lucee admin because the Server Admin password is correct. (I just changed the value and tried again with the new password and it works as expected.)

But it is NOT working for the Web admin. I feel like it had worked previously, but now isn’t for some reason.

I started with just:

{ "adminPassword": "test22" }

after that didn’t work, I tried increasingly different variables to no avail, restarting the docker container each time, sometimes with --force-recreate to ensure I wasn’t getting anything stale or pre-existing.

{
	"adminPassword": "test22"
	, "webadminPassword": "test22"
	, "serveradminPassword": "test22"
	, "serverPassword": "test22"
	, "webPassword": "test22"
	, "web_adminPassword": "test22"
	, "server_adminPassword": "test22"
	, "cfconfig_web_adminPassword": "test22"
	, "cfconfig_server_adminPassword": "test22"
}

Getting loaded, docker log output section:

| Found CFConfig JSON in "CFConfigFile" server.json key.
| Importing luceeserver config from [/config/test-server-cfconfig.json]
| Config transferred from /config/test-server-cfconfig.json!

Any suggestions for me?

Unless you import something specifically into the web context, nothing will get set. You need a .cfconfig-web.json file, or a cfonfig_web_adminPassword environment variable. That doesn’;t work as a key in the JSON. You’re confusing env var naming conventions and JSON keys.

I must be missing something you’re trying to convey. This line is in my docker-compose.yml:

- "BOX_SERVER_CFCONFIGFILE=/config/test-server-cfconfig.json"

And I showed the log lines where it’s being imported.
And I indicated that the Server admin gets the password I specify.
And I showed the (partial) password clip of the json file.

Is there some other key I’m supposed to be using in the json file other than adminPassword to set the Web admin password, not just for the Server admin? Obviously the myriad of things I tried aren’t the answer. (My other keys are being respected (like getting the datasources set up correctly).

I know you indicated an environment variable, but a) not sure if that will work in this docker compose setup and b) I’d prefer to keep as much config in one place as I can.

Lucee server and web contexts are two different things. The default CFConfig file will ONLY be imported into the server context. So unless you go out of your way to specifically put some configuration in place to import settings into the web context, that will not happen. Nothing will be imported into the web context. Nada. Zilch. You can put every key in the universe into the JSON file, but so long as it’s only getting imported to the server context, it will not affect the web context.

The two solutions I provided in my previous reply are still valid.

  • Create a file named .cfconfig-web.json in the web root which will be imported into the web context by convention
  • set an env var named cfconfig_web_adminPassword which will be imported into the web context

Or if you prefer to use the server.json to control things, then set your web JSON file in there as well.

server set cfconfig.web=.cfconfig-web.json

which can also be overridden by an env var like you are doing for the server context config file

box_server_cfconfig_web=.cfconfig-web.json

Yes, imported into the server context. Not the web context.

Yes, because that’s where it was imported into. The server context.

Importing luceeserver config

:point_up: See where it says “luceeserver”? That would say “luceeweb” if it were going into the web context.

Yep, the one imported into the server context.

Nope, adminPassword the right key. You just have to import it into the web context. CFConfig will only import into one place at a time. Importing settings into the web context is a separate step from importing into the server context.

I don’t know why it wouldn’t. I mean you’re using a BOX_SERVER_CFCONFIGFILE env var to point to the JSON file, right? And i assume that env var is working so I don’t see why another env var wouldn’t also work. Of course, you don’t have to use an env var, but it should work as well as the other one you’re already using.

Check out the docs which cover all this:

Okay, your explanation covered it there. I didn’t realize that none of the web side stuff got set. Guessing that’s not as easily possible because… there is no web yet?

Honestly, I probably wasted your time here. The web-side is going to inherit probably 100% of applicable settings from the server when the site is first hit I would guess. I didn’t NEED to set the password, I just… well, it didn’t work!

Thanks for taking the time (this time and always in your forum replies) to tackle individual statements from the person asking the questions. I LOVE that you’re so detailed in your answers and really are trying to help out the users. Ortus team rocks, y’all!

My pleasure. It’s worth setting the password just to make sure it’s secured, but the only other reason most people use the web context is for scheduled tasks. If you don’t have any of those, then there’s usually not much to put there.