Closed francislavoie closed 1 year ago
Should I just remove the duplicate global options check? I wrote it more as a PoC with the language server rather than a proper validation rule. I can easily fix the comments, but checking if a directive is allowed to be duplicated is more challenging.
Technically the log
directive itself cannot be duplicated, but if you specify a unique argument it can.
{
log test { }
log test2 { }
}
is valid, while
{
log test { }
log test { }
}
should trigger a warning.
I don't think it's a particularly useful check. Caddy will complain when adapting if it matters.
But I am an "expert" and I'm less likely to make that mistake anyways, so my opinion isn't from a perspective of a beginner.
I can say it isn't something we ever hear about being an issue when providing support on the Caddy community forums.
Thanks!
Do comments count as comments now (i.e. #
gets lexed before it being an "option")? That commit doesn't seem to suggest you adjusted that.
Ah, I just noticed that as well. I'll see what I can do before cutting a release later.
Do comments count as comments now (i.e.
#
gets lexed before it being an "option")? That commit doesn't seem to suggest you adjusted that.
When there's multiple comments in a global options block, the
#
gets read as the global option name, and then gets marked as a duplicate. Comments here should take precedence over that rule.Also, some global options can be repeated, actually, so I'm not sure that's a correct rule to have. See
log
which can be repeated with different logger names https://caddyserver.com/docs/caddyfile/options