Skip to content

Commit

Permalink
Add test notify hook execution command.
Browse files Browse the repository at this point in the history
Fix bug where notification hooks would always be executed from the
default directory.
  • Loading branch information
hlandau committed Dec 11, 2015
1 parent d6de74a commit 3695d78
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/acmetool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ var (
redirectorPathFlag = redirectorCmd.Flag("path", "Path to serve challenge files from").String()
redirectorGIDFlag = redirectorCmd.Flag("challenge-gid", "GID to chgrp the challenge path to (optional)").String()

testNotifyCmd = kingpin.Command("test-notify", "Test-execute notification hooks as though given hostnames were updated")
testNotifyArg = testNotifyCmd.Arg("hostname", "hostnames which have been updated").Strings()

importJWKAccountCmd = kingpin.Command("import-jwk-account", "Import a JWK account key")
importJWKURLArg = importJWKAccountCmd.Arg("provider-url", "Provider URL (e.g. https://acme-v01.api.letsencrypt.org/directory)").Required().String()
importJWKPathArg = importJWKAccountCmd.Arg("private-key-file", "Path to private_key.json").Required().ExistingFile()
Expand All @@ -67,6 +70,7 @@ var (
func main() {
adaptflag.Adapt()
cmd := kingpin.Parse()
notify.DefaultHookPath = *hooksFlag
xlogconfig.Init()

if *batchFlag {
Expand All @@ -92,6 +96,8 @@ func main() {
cmdQuickstart()
case "redirector":
cmdRunRedirector()
case "test-notify":
cmdRunTestNotify()
case "import-key":
cmdImportKey()
case "import-jwk-account":
Expand Down Expand Up @@ -182,6 +188,11 @@ func determineWebroot() string {
return "/var/run/acme/acme-challenge"
}

func cmdRunTestNotify() {
err := notify.Notify(*hooksFlag, *stateFlag, *testNotifyArg)
log.Errore(err, "notify")
}

// YAML response file loading.

func loadResponseFile(path string) error {
Expand Down

0 comments on commit 3695d78

Please sign in to comment.