From d8135505d38ca872d507418d2017f4dbf352f06a Mon Sep 17 00:00:00 2001 From: pistasjis <57069715+pistasjis@users.noreply.github.com> Date: Wed, 9 Aug 2023 19:40:37 +0200 Subject: cmd: Require config for caddy validate (fix #5612) (#5614) * Require config for caddy validate - fixes #5612 Signed-off-by: Pistasj * Try making adjacent Caddyfile check its own function Signed-off-by: Pistasj * add Francis' suggestion Co-authored-by: Francis Lavoie * Refactor * Fix borked commit, sigh --------- Signed-off-by: Pistasj Co-authored-by: Francis Lavoie Co-authored-by: Matthew Holt --- cmd/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'cmd/main.go') diff --git a/cmd/main.go b/cmd/main.go index bfbd0bb..53b8d67 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -117,9 +117,8 @@ func loadConfigWithLogger(logger *zap.Logger, configFile, adapterName string) ([ zap.String("config_adapter", adapterName)) } } else if adapterName == "" { - // as a special case when no config file or adapter - // is specified, see if the Caddyfile adapter is - // plugged in, and if so, try using a default Caddyfile + // if the Caddyfile adapter is plugged in, we can try using an + // adjacent Caddyfile by default cfgAdapter = caddyconfig.GetAdapter("caddyfile") if cfgAdapter != nil { config, err = os.ReadFile("Caddyfile") -- cgit v1.2.3