Make it usable from babashka

This commit is contained in:
arne 2024-01-06 10:42:11 +01:00
commit a0a1a42351
7 changed files with 6 additions and 29 deletions

View file

@ -1 +0,0 @@
/target

View file

@ -1,2 +0,0 @@
{:mastodon-instance "https://botsin.space"
:access-token "ACCESS_TOKEN"}

View file

@ -1,9 +0,0 @@
FROM clojure:openjdk-8-lein-2.8.3-alpine
RUN mkdir -p /usr/src/app/resources
VOLUME /usr/src/app/resources
WORKDIR /usr/src/app
COPY project.clj /usr/src/app
RUN lein deps
COPY . /usr/src/app
RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar
CMD ["java", "-jar", "app-standalone.jar"]

View file

@ -1 +0,0 @@
web: java -jar app-standalone.jar resources/kafka-metamorphosis.txt

1
bb.edn Normal file
View file

@ -0,0 +1 @@
{:paths ["src"]}

View file

@ -1,14 +0,0 @@
(defproject heyarne.frantisek-kafka "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/tools.cli "0.4.1"]
[com.taoensso/timbre "4.10.0"]
[clj-http "3.9.1"]
[com.knrz/dotenv "0.1.0"]]
:main heyarne.frantisek-kafka.samsa
:target-path "target/%s"
:min-lein-version "2.8.0"
:profiles {:uberjar {:aot :all}})

View file

@ -3,8 +3,7 @@
(:require [clojure.string :as str] (:require [clojure.string :as str]
[clojure.tools.cli :refer [parse-opts]] [clojure.tools.cli :refer [parse-opts]]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[clj-http.client :as http] [org.httpkit.client :as http]
[dotenv.core :refer [env]]
[heyarne.frantisek-kafka.markov :as markov]) [heyarne.frantisek-kafka.markov :as markov])
(:gen-class)) (:gen-class))
@ -38,6 +37,10 @@
;; interacting with the API ;; interacting with the API
(def env
{:mastodon-instance (System/getenv "MASTODON_INSTANCE")
:access-token (System/getenv "ACCESS_TOKEN")})
(defn environment-setup? [] (defn environment-setup? []
(and (:mastodon-instance env) (:access-token env))) (and (:mastodon-instance env) (:access-token env)))