Changed filenames to include first domain or inbound port#5515
Conversation
|
Docker Image for build 1 is available on DockerHub: Note Ensure you backup your NPM instance before testing this image! Especially if there are database changes. Warning Changes and additions to DNS Providers require verification by at least 2 members of the community! |
|
Thanks for the contribution. I've asked Claude for a review and here's the parts I agree with: Issues
|
| let template = null; | ||
| const filename = internalNginx.getConfigName(nice_host_type, host.id); | ||
|
|
||
| host.nginx_file_stem = utils.getNginxFileStem(nice_host_type, host); |
There was a problem hiding this comment.
generateConfigmutates the caller's object to inject nginx_file_stem for template rendering.
This is actually incorrect. The host constant was already created as a clone (deep copy) of the host_row from the caller just a few lines above to prevent this exact situation (hence the comment):
nginx-proxy-manager/backend/internal/nginx.js
Lines 188 to 190 in 9875a76
| describe("diskConfigFilenamesToDelete", () => { | ||
| it("selects id.conf, id.suffix.conf, and optionally id.suffix.conf.err", () => { | ||
| const names = ["1.conf", "1.example.com.conf", "1.example.com.conf.err", "2.conf", "other.conf"]; | ||
| assert.deepEqual(diskConfigFilenamesToDelete(names, 1, false).sort(), ["1.conf", "1.example.com.conf"]); | ||
| assert.deepEqual(diskConfigFilenamesToDelete(names, 1, true).sort(), [ | ||
| "1.conf", | ||
| "1.example.com.conf", | ||
| "1.example.com.conf.err", | ||
| ]); | ||
| }); | ||
| }); | ||
|
|
||
| describe("letsencryptTempConfigFilenamesToDelete", () => { | ||
| it("selects letsencrypt_id.conf and letsencrypt_id.slug.conf", () => { | ||
| const names = ["letsencrypt_3.conf", "letsencrypt_3.app.example.conf", "letsencrypt_4.conf"]; | ||
| assert.deepEqual(letsencryptTempConfigFilenamesToDelete(names, 3).sort(), [ | ||
| "letsencrypt_3.app.example.conf", | ||
| "letsencrypt_3.conf", | ||
| ]); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Bug:
letsencryptTempConfigFilenamesToDeleteonly deletesletsencrypt_{id}.{slug}.conf, notletsencrypt_{id}.confHowever, the test for this function doesn't exercise the bare
letsencrypt_{id}.confform withdeleteErrFile=false/true, so the coverage is incomplete. Worth adding.
Claude seems to be hallucinating here, I think? The deleteErrFile param is part of diskConfigFilenamesToDelete, not letsencryptTempConfigFilenamesToDelete. Regardless, I explicitly test the bare ID in both cases. I have 1.conf on line 94 and letsencrypt_3.conf on line 106.
Closes: #746
This PR is an upgraded replacement for #2606.
This PR changes all config filenames to be
id.first_domainfor proxy_host, redirection_host or dead_host andid.incoming_portfor stream. Each type will fall back to justidif there are no domains or if the type is undefined. All log files will also be renamed accordingly automatically.This will also happen if the user either adds a domain to the host that sorts alphabetically first or if they remove the first domain. These changes will not take effect immediately, which seems to be in-line with the rest of the upgrades in this project. They will instead update the next time each host is saved.