Merge branch 'master' of gitlab.com:domaindrivenarchitecture/k8s-mastodon-bot

This commit is contained in:
jem 2021-03-19 16:26:18 +01:00
commit 1a79eacefe
4 changed files with 8 additions and 12 deletions

View file

@ -66,13 +66,13 @@
<br><br> <br><br>
<button type="button" id="generate-button" class="btn btn-primary"> <button type="button" id="generate-button" class="btn btn-primary">
Generate k8s yaml Generate k8s yaml
</button><br><br> </button></form><br><br>
<div id="k8s-mastodon-bot-output"> <div id="k8s-mastodon-bot-output">
<label for="output" class="form-label">Your k8s deployment.yaml:</label> <label for="output" class="form-label">Your k8s deployment.yaml:</label>
<textarea name="output" id="output" class="form-control" rows="15"> <textarea name="output" id="output" class="form-control" rows="15">
</textarea> </textarea>
</div> </div>
</form>
</div> </div>
<script src="js/main.js"></script> <script src="js/main.js"></script>
</body> </body>

View file

@ -2,16 +2,11 @@
(:require (:require
[clojure.string :as cs] [clojure.string :as cs]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
#?(:clj [orchestra.core :refer [defn-spec]] #?(:clj [orchestra.core :refer [defn-spec]]
:cljs [orchestra.core :refer-macros [defn-spec]]) :cljs [orchestra.core :refer-macros [defn-spec]])
[expound.alpha :as expound]
[mastodon-bot.core-domain :as cd] [mastodon-bot.core-domain :as cd]
[dda.k8s-mastodon-bot.yaml :as yaml])) [dda.k8s-mastodon-bot.yaml :as yaml]))
#?(:clj (alter-var-root #'s/*explain-out* (constantly expound/printer))
:cljs (set! s/*explain-out* expound/printer))
(def config? cd/config?) (def config? cd/config?)
(def auth? (s/keys :req-un [::cd/auth])) (def auth? (s/keys :req-un [::cd/auth]))
@ -34,5 +29,3 @@
[(yaml/to-string (generate-config my-config my-auth)) [(yaml/to-string (generate-config my-config my-auth))
"---" "---"
(yaml/to-string (generate-deployment))])) (yaml/to-string (generate-deployment))]))
(st/instrument 'dda.k8s-mastodon-bot.core)

View file

@ -82,8 +82,11 @@
(-> js/document (-> js/document
(.getElementById "generate-button") (.getElementById "generate-button")
(.addEventListener "click" (.addEventListener "click"
#(-> (core/generate (config-from-document) (auth-from-document)) #(do (validate-config!)
(set-output!)))) (validate-auth!)
(set-validated!)
(-> (core/generate (config-from-document) (auth-from-document))
(set-output!)))))
(-> (config) (-> (config)
(.addEventListener "blur" (.addEventListener "blur"
#(do (validate-config!) #(do (validate-config!)

View file

@ -10,4 +10,4 @@
:labels {:app.kubernetes.io/name "k8s-mastodon-bot"}}, :labels {:app.kubernetes.io/name "k8s-mastodon-bot"}},
:data {:config.edn "some-config-value\n", :data {:config.edn "some-config-value\n",
:credentials.edn "some-credentials-value\n"}} :credentials.edn "some-credentials-value\n"}}
(cut/from-string (cut/load-resource "config.yaml"))))) (cut/generate-config "some-config-value\n" "some-credentials-value\n"))))