caddy icon indicating copy to clipboard operation
caddy copied to clipboard

caddy.go: Check whether @id is unique

Open Chise1 opened this issue 6 months ago • 7 comments

Fixes: https://github.com/caddyserver/caddy/issues/6991

Check whether @id is unique.If it is not unique,rollback caddy config json. I'm not sure if it can work properly under caddyfile.

Chise1 avatar May 07 '25 07:05 Chise1

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 07 '25 07:05 CLAassistant

I added length detection and fixed a stupid problem. From the perspective of code analysis, "err" will not be repeated.

Changes of rewrite, involves nginx-adapter-case

Chise1 avatar May 13 '25 09:05 Chise1

Changes of rewrite, involves nginx-adapter-case

Please keep the PR topical and focused. Split these changes into a separate PR.

mohammed90 avatar May 13 '25 09:05 mohammed90

I have deleted the irrelevant pr

Chise1 avatar May 13 '25 11:05 Chise1

I feel like a better approach would be to check the ID as it's being read in and we're creating the mapping of IDs to their full config paths. If we return an error the rest should be handled automatically (no need to roll back, etc)

mholt avatar May 13 '25 18:05 mholt

I feel like a better approach would be to check the ID as it's being read in and we're creating the mapping of IDs to their full config paths. If we return an error the rest should be handled automatically (no need to roll back, etc)

If we do as you said, the content that needs to be modified is rather complicated. This is beyond my ability. I'm worried that the modification will introduce bugs.

Chise1 avatar May 14 '25 02:05 Chise1

add one test.

Chise1 avatar May 15 '25 02:05 Chise1