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>
<button type="button" id="generate-button" class="btn btn-primary">
Generate k8s yaml
</button><br><br>
</button></form><br><br>
<div id="k8s-mastodon-bot-output">
<label for="output" class="form-label">Your k8s deployment.yaml:</label>
<textarea name="output" id="output" class="form-control" rows="15">
</textarea>
</div>
</form>
</div>
<script src="js/main.js"></script>
</body>

View file

@ -2,16 +2,11 @@
(:require
[clojure.string :as cs]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
#?(:clj [orchestra.core :refer [defn-spec]]
:cljs [orchestra.core :refer-macros [defn-spec]])
[expound.alpha :as expound]
[mastodon-bot.core-domain :as cd]
[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 auth? (s/keys :req-un [::cd/auth]))
@ -34,5 +29,3 @@
[(yaml/to-string (generate-config my-config my-auth))
"---"
(yaml/to-string (generate-deployment))]))
(st/instrument 'dda.k8s-mastodon-bot.core)

View file

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

View file

@ -10,4 +10,4 @@
:labels {:app.kubernetes.io/name "k8s-mastodon-bot"}},
:data {:config.edn "some-config-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"))))