Skip to content

Commit

Permalink
cmd: Only validate config is proper JSON if config slice has data (#6250
Browse files Browse the repository at this point in the history
)

* cmd: fix error when running without config

* ci: add smoke test
  • Loading branch information
mohammed90 authored Apr 18, 2024
1 parent c6673ad commit 8f87c5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8f87c5d

Please sign in to comment.