mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 05:33:49 +03:00
cmd: Only validate config is proper JSON if config slice has data (#6250)
* cmd: fix error when running without config * ci: add smoke test
This commit is contained in:
parent
c6673ad4d8
commit
8f87c5d993
2 changed files with 7 additions and 1 deletions
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
@ -101,6 +101,12 @@ jobs:
|
|||
run: |
|
||||
go build -tags nobdger -trimpath -ldflags="-w -s" -v
|
||||
|
||||
- name: Smoke test Caddy
|
||||
working-directory: ./cmd/caddy
|
||||
run: |
|
||||
./caddy start
|
||||
./caddy stop
|
||||
|
||||
- name: Publish Build Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
|
|
@ -199,7 +199,7 @@ func loadConfigWithLogger(logger *zap.Logger, configFile, adapterName string) ([
|
|||
zap.Int("line", warn.Line))
|
||||
}
|
||||
config = adaptedConfig
|
||||
} else {
|
||||
} else if len(config) != 0 {
|
||||
// validate that the config is at least valid JSON
|
||||
err = json.Unmarshal(config, new(any))
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue