Skip to content

Commit dee34d7

Browse files
committed
renew method
1 parent 7533233 commit dee34d7

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/certificaat/interface/cli.clj

+10-11
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
""]
5858
(str/join \newline)))
5959

60-
6160
(defn error-msg [errors]
6261
(str "The following errors occurred while parsing your command:\n\n"
6362
(str/join \newline errors)))
@@ -124,6 +123,14 @@
124123
(request options)
125124
(h/run-hooks :after-request options))
126125
:else (exit 0 "Nothing left to do at this point in time.")))
126+
(defn renew [{domain :domain config-dir :config-dir :as options}]
127+
(if (k/valid? (str config-dir domain "/authorization." domain ".uri") options)
128+
(request options)
129+
(do (authorize options)
130+
(h/run-hooks :before-challenge options)
131+
(accept-challenges options)
132+
(request options)))
133+
(h/run-hooks :after-request options))
127134

128135
(defn certificaat [args]
129136
(let [{:keys [action options exit-message ok?]} (validate-args args)]
@@ -155,13 +162,5 @@
155162
(puget/cprint config-options)))
156163
"cron" (let [cli-options (validate ::domain/cli-options options)
157164
config-options (validate ::domain/config (c/read-config options))
158-
options (merge config-options cli-options)
159-
{domain :domain config-dir :config-dir} options]
160-
(if (k/valid? (str config-dir domain "/authorization." domain ".uri") options)
161-
(request options)
162-
(do (authorize options)
163-
(h/run-hooks :before-challenge options)
164-
(accept-challenges options)
165-
(request options)))
166-
(h/run-hooks :after-request options))))))
167-
165+
options (merge config-options cli-options)]
166+
(renew options))))))

0 commit comments

Comments
 (0)