Skip to content

Commit

Permalink
renew method
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsz committed Nov 28, 2017
1 parent 7533233 commit dee34d7
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/certificaat/interface/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
""]
(str/join \newline)))


(defn error-msg [errors]
(str "The following errors occurred while parsing your command:\n\n"
(str/join \newline errors)))
Expand Down Expand Up @@ -124,6 +123,14 @@
(request options)
(h/run-hooks :after-request options))
:else (exit 0 "Nothing left to do at this point in time.")))
(defn renew [{domain :domain config-dir :config-dir :as options}]
(if (k/valid? (str config-dir domain "/authorization." domain ".uri") options)
(request options)
(do (authorize options)
(h/run-hooks :before-challenge options)
(accept-challenges options)
(request options)))
(h/run-hooks :after-request options))

(defn certificaat [args]
(let [{:keys [action options exit-message ok?]} (validate-args args)]
Expand Down Expand Up @@ -155,13 +162,5 @@
(puget/cprint config-options)))
"cron" (let [cli-options (validate ::domain/cli-options options)
config-options (validate ::domain/config (c/read-config options))
options (merge config-options cli-options)
{domain :domain config-dir :config-dir} options]
(if (k/valid? (str config-dir domain "/authorization." domain ".uri") options)
(request options)
(do (authorize options)
(h/run-hooks :before-challenge options)
(accept-challenges options)
(request options)))
(h/run-hooks :after-request options))))))

options (merge config-options cli-options)]
(renew options))))))

0 comments on commit dee34d7

Please sign in to comment.