summaryrefslogtreecommitdiff
path: root/cmd/commandfuncs.go
AgeCommit message (Collapse)Author
2022-04-28cmd: Fix unix socket addresses for admin API requests (#4742)Francis Lavoie
Fixes a regression in c2327161f725c820826587381f37d651a2b9736d
2022-04-25httpcaddyfile: Deprecate paths in site addresses; use zap logs (#4728)Francis Lavoie
2022-04-12cmd: Add `--diff` option for `caddy fmt` (#4695)Francis Lavoie
2022-04-03cmd: Fix defaulting admin address if empty in config, fixes `reload` (#4674)Francis Lavoie
2022-03-19cmd: Set Origin header properly on API requestsMatthew Holt
Ref. https://caddy.community/t/bug-in-enforce-origin/15417
2022-03-02pki: Implement API endpoints for certs and `caddy trust` (#4443)Francis Lavoie
* admin: Implement /pki/certificates/<id> API * pki: Lower "skip_install_trust" log level to INFO See https://github.com/caddyserver/caddy/issues/4058#issuecomment-976132935 It's not necessary to warn about this, because this was an option explicitly configured by the user. Still useful to log, but we don't need to be so loud about it. * cmd: Export functions needed for PKI app, return API response to caller * pki: Rewrite `caddy trust` command to use new admin endpoint instead * pki: Rewrite `caddy untrust` command to support using admin endpoint * Refactor cmd and pki packages for determining admin API endpoint
2022-01-16cmd: Print error if fmt overwrite fails (fix #4524)Matthew Holt
2021-10-18caddycmd: Add `--skip-standard` to `list-modules` command, quieter output ↵Francis Lavoie
(#4386) * caddycmd: Add --skip-standard to list-modules command, quieter output * caddycmd: Also quiet `caddy upgrade` output, redundant information
2021-09-29Move from deprecated ioutil to os and io packages (#4364)KallyDev
2021-09-01cmd: export CaddyVersion(), Commands() (#4316)peymaneh
* cmd: Export CaddyVersion() * cmd: Add getter Commands()
2021-08-18cmd: use net.ErrClosed for matching returned error (#4289)M. Ángel Jimeno
Implements #3805
2021-08-11cmd: New `add-package` and `remove-package` commands (#4226)Oleg
* adding package command * add-package command name * refactoring duplicate code * fixed by review * fixed by review * remove-package command * commands in different files, common utils * fix add, remove, upgrade packages in 1 file * copyright and downloadPath moved * refactor * downloadPath do no export * adding/removing multiple packages * addPackages/removePackages, comments, command-desc * add-package, process case len(args) == 0 Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2021-05-11cmd: upgrade: inherit the permissions of the original executable (#4160)Mohammed Al Sahaf
2021-05-02cmd: Add --envfile flag to `start` command (#4141)Jesse
* add envfile in start cmd * fix commandfuncs * fix commandfuncs * fix cmdStart envfile from bool to string Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2021-04-05notify: Send all sd_notify signals from main caddy process (#4060)Carl George
Initial sd_notify support was added in #3963, but that sent signals from both cmdRun and cmdReload. This approach has two drawbacks: - Reloads initiated via the API do not send signals. - The signals are sent from different processes, which requires the `NotifyAccess=exec` directive in the unit file. This change moves the NotifyReloading and NotifyReadiness invocations to Load, which address both of those drawbacks. It also adds a complimentary NotifyStopping method which is invoked from handleStop. All the notify methods are defined in a notify package to avoid an import loop.
2021-02-22caddytls: Remove old asset migration code (close #3894)Matthew Holt
2021-02-15cmd: Clean up `build-info` and `upgrade` outputMatthew Holt
2021-02-01cmd: Add --force flag to reload command (close #4005)Matthew Holt
Can be useful if user wants to reload manual certificates, for example.
2021-01-19caddycmd: Add upgrade command (#3972)Matt Holt
Replaces the current Caddy executable with a new one from the build server. Honors custom builds, as long as plugins are registered on the Caddy website. Requires permissions to replace current executable, of course. This is an experimental command that may get changed or removed later.
2021-01-19caddytest: Update Caddyfile tests for formatting, HTTP-only blocksMatthew Holt
Previous commit improved the Caddyfile adapter so it doesn't unnecessarily add names to "skip" in "auto_https" when the server is already HTTP-only. This commit updates the tests to reflect that change, while also fixing the Caddyfile formatting in many of the tests. We also print the line number of the divergence between input and formatted version in Caddyfile adapt warnings - very useful for finding initial formatting problems.
2021-01-16cmd: Print more detailed version with --environMatthew Holt
2021-01-12cmd: Implement sd_notify() to notify systemd about readiness (#3963)Stefan Tatschner
Issue: #3786 Based on Gaurav Dhameeja's work in #3908.
2021-01-04cmd: Organize list-modules output; --packages flag (#3925)Matt Holt
2021-01-04caddyfile: Introduce basic linting and fmt check (#3923)Matt Holt
* caddyfile: Introduce basic linting and fmt check This will help encourage people to keep their Caddyfiles tidy. * Remove unrelated tests I am not sure that testing the output of warnings here is quite the right idea; these tests are just for syntax and parsing success.
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-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-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-10cmd: Add build-info command; update CertMagicMatthew Holt
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