Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ A major release: automatic Let's Encrypt SSL with multi-DNS-provider support.
- `easy proxy create` no longer writes a state file into the install directory.
After `npm install -g` that directory is root-owned, so non-root users got
`Permission denied` ([#5]).
- `easy --version` and `easy proxy help` now work before the runtime env vars
(`EASY_LETSENCRYPT_DIR`, `EASY_DOMAINS_DIR`) are set — they no longer fail
with `... is not set!`, so a freshly installed CLI can be inspected.
- Argument quoting hardened across the `easy` dispatcher and `commands/proxy.sh`
(ShellCheck cleanup).

Expand Down
12 changes: 10 additions & 2 deletions easy
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@ function easy_verify_dir {
fi
}

easy_verify_dir EASY_LETSENCRYPT_DIR "$EASY_LETSENCRYPT_DIR"
easy_verify_dir EASY_DOMAINS_DIR "$EASY_DOMAINS_DIR"
# `easy --version` and `easy proxy help` are informational — they need
# neither EASY_LETSENCRYPT_DIR nor EASY_DOMAINS_DIR. Skip the check for them
# so a freshly installed CLI can be inspected before those env vars are set.
case "$1:$2" in
--version:* | proxy:help) : ;;
*)
easy_verify_dir EASY_LETSENCRYPT_DIR "$EASY_LETSENCRYPT_DIR"
easy_verify_dir EASY_DOMAINS_DIR "$EASY_DOMAINS_DIR"
;;
esac

D="${EASY_DIR}/commands"
function __private_easy_usage {
Expand Down
7 changes: 7 additions & 0 deletions test/dispatcher.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ setup() { easy_setup; }
[ "$output" = "2.0.0" ]
}

@test "easy --version works without the runtime env vars set" {
unset EASY_LETSENCRYPT_DIR EASY_DOMAINS_DIR
run easy --version
[ "$status" -eq 0 ]
[ "$output" = "2.0.0" ]
}

@test "easy with no command prints usage and fails" {
run easy
[ "$status" -eq 1 ]
Expand Down
7 changes: 7 additions & 0 deletions test/proxy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ setup() { easy_setup; }
[[ "$output" == *"easy proxy certbot-ionos <domain>"* ]]
}

@test "easy proxy help works without the runtime env vars set" {
unset EASY_LETSENCRYPT_DIR EASY_DOMAINS_DIR
run easy proxy help
[ "$status" -eq 0 ]
[[ "$output" == *"easy proxy create"* ]]
}

@test "easy proxy with an unknown subcommand prints usage and fails" {
run easy proxy not-a-real-subcommand
[ "$status" -eq 1 ]
Expand Down
Loading