summaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
2020-11-22ci: Use golangci's github action for linting (#3794)Dave Henderson
* ci: Use golangci's github action for linting Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix most of the staticcheck lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the prealloc lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the misspell lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the varcheck lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the errcheck lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the bodyclose lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the deadcode lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the unused lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the gosec lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the gosimple lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the ineffassign lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Fix the staticcheck lint errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Revert the misspell change, use a neutral English Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Remove broken golangci-lint CI job Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Re-add errantly-removed weakrand initialization Signed-off-by: Dave Henderson <dhenderson@gmail.com> * don't break the loop and return * Removing extra handling for null rootKey * unignore RegisterModule/RegisterAdapter Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com> * single-line log message Co-authored-by: Matt Holt <mholt@users.noreply.github.com> * Fix lint after a1808b0dbf209c615e438a496d257ce5e3acdce2 was merged Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Revert ticker change, ignore it instead Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Ignore some of the write errors Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Remove blank line Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Use lifetime Signed-off-by: Dave Henderson <dhenderson@gmail.com> * close immediately Co-authored-by: Matt Holt <mholt@users.noreply.github.com> * Preallocate configVals Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Update modules/caddytls/distributedstek/distributedstek.go Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com> Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
2020-09-14cmd: Allow `caddy fmt` to read from stdin (#3680)Matthew Penner
* Allow 'caddy fmt' to read from stdin * fmt: use '-' as the file name for reading from stdin * Minor adjustments Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>
2020-08-03cmd: Print caddy version with environ or --environ (#3627)Matthew Holt
2020-05-29cmd: Support admin endpoint on unix socket (#3320)Matt Holt
2020-05-21cmd: hash-password: Fix broken terminal state on SIGINT (#3416)Francis Lavoie
* caddyauth: Fix hash-password broken terminal state on SIGINT * caddycmd: Move TrapSignals calls to only subcommands that run long
2020-05-15cmd: Add --envfile flag to run command (#3278)elcore
* run: Add the possibility to load an env file * run: change envfile flag var * run: do not ignore err values * Apply suggestions from code review Co-authored-by: Matt Holt <mholt@users.noreply.github.com> Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
2020-05-13cmd: Add pidfile support (closes #3235)Matthew Holt
2020-05-12all: Recover from panics in goroutinesMatthew Holt
2020-05-11core: Add support for `d` duration unit (#3323)Francis Lavoie
* caddy: Add support for `d` duration unit * Improvements to ParseDuration; add unit tests Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>
2020-05-07docs: Fix command.Func documentation (#3371)Jose Donizetti
2020-04-04cmd: Log warning if --resume and --config used togetherMatthew Holt
There's nothing actually risky/dangerous in this situation, it's mostly an attempt to get the user's attention
2020-03-23cmd: Ensure certmagic defaults are set for any and all subcommandsMatthew Holt
This is really crucial and I'm surprised no one reported a problem yet
2020-03-23tls: Few minor improvements/simplificationsMatthew Holt
2020-03-22cmd: Add --watch flag to start & run commands (closes #1806)Matthew Holt
Because, just for fun.
2020-03-15cmd: fmt: --write -> --overwrite to make it clear it's destructiveMatthew Holt
2020-03-13Minor tweaksMatthew Holt
2020-03-09cmd: Use loadConfig() for validate as run, start, and reload doMatthew Holt
2020-03-06Merge branch 'certmagic-refactor' into v2Matthew Holt
2020-03-06Refactor for CertMagic v0.10; prepare for PKI appMatthew Holt
This is a breaking change primarily in two areas: - Storage paths for certificates have changed - Slight changes to JSON config parameters Huge improvements in this commit, to be detailed more in the release notes. The upcoming PKI app will be powered by Smallstep libraries.
2020-02-29cmd: Add `caddy fmt` command. (#3090)Vaibhav
This takes the config file as input and formats it. Prints the result to stdout. Can write changes to file if `--write` flag is passed. Fixes #3020 Signed-off-by: Vaibhav <vrongmeal@gmail.com>
2020-02-25Fix typo in cmdStart commentSuccess Go
2020-02-04cmd: adapt: Make --config flag optional when Caddyfile existsMatthew Holt
2020-01-22cmd: Emit error if reload cannot find a config to loadMatthew Holt
2020-01-22cmd: Make --config flag optional for reload commandMatthew Holt
In case it is using the default Caddyfile
2020-01-17cmd: version: Add module replace to outputMatthew Holt
2020-01-12cmd: adapt: Set config filename so it can be hidden (fixes #2974)Matthew Holt
2020-01-11cmd: Assume Caddyfile if name starts with CaddyfileMatthew Holt
And doesn't have .json extension -- in case someone names their JSON config something like Caddyfile.json, which is unconventional.
2020-01-10cmd: Add build-info command; update CertMagicMatthew Holt
2020-01-09v2: Implement Caddyfile enhancements (breaking changes) (#2960)Matt Holt
* http: path matcher: exact match by default; substring matches (#2959) This is a breaking change. * caddyfile: Change "matcher" directive to "@matcher" syntax (#2959) * cmd: Assume caddyfile adapter for config files named Caddyfile * Sub-sort handlers by path matcher length (#2959) Caddyfile-generated subroutes have handlers, which are sorted first by directive order (this is unchanged), but within directives we now sort by specificity of path matcher in descending order (longest path first, assuming that longest path is most specific). This only applies if there is only one matcher set, and the path matcher in that set has only one path in it. Path matchers with two or more paths are not sorted like this; and routes with more than one matcher set are not sorted like this either, since specificity is difficult or impossible to infer correctly. This is a special case, but definitely a very common one, as a lot of routing decisions are based on paths. * caddyfile: New 'route' directive for appearance-order handling (#2959) * caddyfile: Make rewrite directives mutually exclusive (#2959) This applies only to rewrites in the top-level subroute created by the HTTP caddyfile.
2019-12-31Couple of minor fixes, update readmeMatthew Holt
2019-12-31Config auto-save; run --resume flag; update environ output (close #2903)Matthew Holt
Config auto-saving is on by default and can be disabled. The --environ flag (or environ subcommand) now print more useful information from Caddy and the runtime, including some nifty paths.
2019-12-31Change storage paths to follow OS conventions; migrate folder (#2955)Matthew Holt
2019-12-23cmd: Eliminate unintended use of cgoMatthew Holt
This means the stop command can only use the API to stop the instance; no more signaling, unless we find a cgo-free way of doing it.
2019-12-16admin: /stop endpoint gracefully shuts down; fixes caddy stop commandMatthew Holt
2019-12-12cmd: Fix validate command when JSON contains "@id" fieldsMatthew Holt
Also, don't run admin server when validating...
2019-12-10v2: Module documentation; refactor LoadModule(); new caddy struct tags (#2924)Matt Holt
This commit goes a long way toward making automated documentation of Caddy config and Caddy modules possible. It's a broad, sweeping change, but mostly internal. It allows us to automatically generate docs for all Caddy modules (including future third-party ones) and make them viewable on a web page; it also doubles as godoc comments. As such, this commit makes significant progress in migrating the docs from our temporary wiki page toward our new website which is still under construction. With this change, all host modules will use ctx.LoadModule() and pass in both the struct pointer and the field name as a string. This allows the reflect package to read the struct tag from that field so that it can get the necessary information like the module namespace and the inline key. This has the nice side-effect of unifying the code and documentation. It also simplifies module loading, and handles several variations on field types for raw module fields (i.e. variations on json.RawMessage, such as arrays and maps). I also renamed ModuleInfo.Name -> ModuleInfo.ID, to make it clear that the ID is the "full name" which includes both the module namespace and the name. This clarity is helpful when describing module hierarchy. As of this change, Caddy modules are no longer an experimental design. I think the architecture is good enough to go forward.
2019-11-15cmd: Improve stop command by trying API before signaling processMatthew Holt
This allows graceful shutdown on all platforms
2019-11-08cmd: Print errors to stderrMatthew Holt
2019-11-04cmd: Move module imports into standard packagesMatthew Holt
This makes it easier to make "standard" caddy builds, since you'll only need to add a single import to get all of Caddy's standard modules. There is a package for all of Caddy's standard modules (modules/standard) and a package for the HTTP app's standard modules only (modules/caddyhttp/standard). We still need to decide which of these, if not all of them, should be kept in the standard build. Those which aren't should be moved out of this repo. See #2780.
2019-11-04core: Major refactor of admin endpoint and config handlingMatthew Holt
Fixed several bugs and made other improvements. All config changes are now mediated by the global config state manager. It used to be that initial configs given at startup weren't tracked, so you could start caddy with --config caddy.json and then do a GET /config/ and it would return null. That is fixed, along with several other general flow/API enhancements, with more to come.
2019-10-30admin listener as opt-in for initial config (#2834)Andreas Schneider
* Always cleanup admin endpoint first * Error out if no config has been set (#2833) * Ignore explicitly missing admin config (#2833) * Separate config loading from admin initialization (#2833) * Add admin option to specify admin listener address (#2833) * Use zap for reporting admin endpoint status
2019-10-29Plug in distributed STEK moduleMatthew Holt
2019-10-28v2: Logging! (#2831)Matt Holt
* logging: Initial implementation * logging: More encoder formats, better defaults * logging: Fix repetition bug with FilterEncoder; add more presets * logging: DiscardWriter; delete or no-op logs that discard their output * logging: Add http.handlers.log module; enhance Replacer methods The Replacer interface has new methods to customize how to handle empty or unrecognized placeholders. Closes #2815. * logging: Overhaul HTTP logging, fix bugs, improve filtering, etc. * logging: General cleanup, begin transitioning to using new loggers * Fixes after merge conflict
2019-10-15v2: Project-and-CI-wide linter config (#2812)Mohammed Al Sahaf
* v2: split golangci-lint configuration into its own file to allow code editors to take advantage of it * v2: simplify code * v2: set the correct lint output formatting * v2: invert the logic of linter's configuration of output formatting to allow the editor convenience over CI-specific customization. Customize the output format in CI by passing the flag. * v2: remove irrelevant golangci-lint config
2019-10-10cmd: Plug in the http.handlers.authentication moduleMatthew Holt
2019-10-10http: Add Starlark handlerMatthew Holt
This migrates a feature that was previously reserved for enterprise users, according to #2786. The Starlark integration needs to be updated since this was made before some significant changes in the v2 code base. When functional, it makes it possible to have very dynamic HTTP handlers. This will be a long-term ongoing project. Credit to Danny Navarro
2019-10-09http: Add work-in-progress cache handler moduleMatthew Holt
This migrates a feature that was previously reserved for enterprise users, according to https://github.com/caddyserver/caddy/issues/2786. The cache HTTP handler will be a high-performing, distributed cache layer for HTTP requests. Right now, the implementation is a very basic proof-of-concept, and further development is required.
2019-10-08cmd: Built-in commands all use RegisterCommand (#2794)yzongyue
2019-10-06cmd/main: Plug in json5 and jsonc config adaptersMatthew Holt
2019-10-06cmd: adapt: Default --adapter value is "caddyfile"Matthew Holt