-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
252 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
{:deps {org.clojars.hephaistox/automaton-build-app {:mvn/version "0.0.72"}} | ||
;;The file is updated automatically | ||
{:deps {org.clojars.hephaistox/automaton-build-app {:mvn/version "0.0.74"}} | ||
:paths [] | ||
:tasks {:requires [[automaton-build-app.tasks.launcher.bb-entrypoint :as build-task-bb-entrypoint] [babashka.process :as babahska-process]] | ||
heph-task {:doc "Launch an Hephaistox task" | ||
:task (System/exit (build-task-bb-entrypoint/-main *command-line-args*))} | ||
lconnect {:doc "Repl in case automaton-core is failing. Using -f or --force cli arguments to force start if some part are failing" | ||
:task (try (-> (babahska-process/shell "clojure" "-M:common-test:env-development-repl:build" *command-line-args*) | ||
System/exit) | ||
(catch Exception e (println "Repl failed also - error during repl startup" (ex-message e))))}}} | ||
(catch Exception e (println "Repl failed also - error during repl startup" (ex-message e))))}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
{:app-name "automaton-core" | ||
:task-shared {:gha {} | ||
:mermaid-dir "docs/code/" | ||
:publication {:as-lib org.clojars.hephaistox/automaton-core | ||
:branch "main" | ||
:deploy-to :clojars | ||
:jar-path "target/prod/automaton-core.jar" | ||
:major-version "0.0.%d" | ||
:pom-path "target/prod/class/META-INF/maven/org.clojars.hephaistox/automaton-core/pom.xml" | ||
:repo "[email protected]:hephaistox/automaton-core.git"} | ||
:repl-aliases [:common-test :env-development-repl :build] | ||
:storage-datomic {:datomic-ver "1.0.7021"}} | ||
:repl-aliases [:common-test :env-development-repl :build]} | ||
:tasks {:clean {:dirs [".cpcache/" ".clj-kondo/.cache/" "tmp/" "target/" "node_modules/" ".shadow-cljs/builds/"]} | ||
:reports {:forbiddenwords-words #{"automaton-web" "landing" "tap>"}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<packaging>jar</packaging> | ||
<groupId>org.clojars.hephaistox</groupId> | ||
<artifactId>automaton-core</artifactId> | ||
<version>0.0.55</version> | ||
<name>automaton-core</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.clojure</groupId> | ||
<artifactId>data.json</artifactId> | ||
<version>2.5.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.clojure</groupId> | ||
<artifactId>clojure</artifactId> | ||
<version>1.11.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j2-impl</artifactId> | ||
<version>2.22.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.clojure</groupId> | ||
<artifactId>tools.logging</artifactId> | ||
<version>1.2.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.clojure</groupId> | ||
<artifactId>tools.cli</artifactId> | ||
<version>1.0.219</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>danlentz</groupId> | ||
<artifactId>clj-uuid</artifactId> | ||
<version>0.1.9</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.clojure-goes-fast</groupId> | ||
<artifactId>clj-memory-meter</artifactId> | ||
<version>0.3.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.taoensso</groupId> | ||
<artifactId>encore</artifactId> | ||
<version>3.62.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.sentry</groupId> | ||
<artifactId>sentry</artifactId> | ||
<version>7.1.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.datomic</groupId> | ||
<artifactId>peer</artifactId> | ||
<version>1.0.7075</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.sentry</groupId> | ||
<artifactId>sentry-clj</artifactId> | ||
<version>6.33.209</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.postgresql</groupId> | ||
<artifactId>postgresql</artifactId> | ||
<version>42.7.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.taoensso</groupId> | ||
<artifactId>tempura</artifactId> | ||
<version>1.5.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>refactor-nrepl</groupId> | ||
<artifactId>refactor-nrepl</artifactId> | ||
<version>3.6.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>djblue</groupId> | ||
<artifactId>portal</artifactId> | ||
<version>0.51.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
<version>2.22.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>zprint</groupId> | ||
<artifactId>zprint</artifactId> | ||
<version>1.2.8</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>metosin</groupId> | ||
<artifactId>malli</artifactId> | ||
<version>0.13.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>babashka</groupId> | ||
<artifactId>process</artifactId> | ||
<version>0.5.21</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>nrepl</groupId> | ||
<artifactId>nrepl</artifactId> | ||
<version>1.1.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>mount</groupId> | ||
<artifactId>mount</artifactId> | ||
<version>0.1.17</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-api</artifactId> | ||
<version>2.22.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>lambdaisland</groupId> | ||
<artifactId>uri</artifactId> | ||
<version>1.16.134</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>babashka</groupId> | ||
<artifactId>fs</artifactId> | ||
<version>0.5.20</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>http-kit</groupId> | ||
<artifactId>http-kit</artifactId> | ||
<version>2.7.0</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<sourceDirectory>env/development/src/clj/</sourceDirectory> | ||
</build> | ||
<repositories> | ||
<repository> | ||
<id>clojars</id> | ||
<url>https://repo.clojars.org/</url> | ||
</repository> | ||
</repositories> | ||
<licenses> | ||
<license> | ||
<name>Eclipse Public License 1.0</name> | ||
<url>https://opensource.org/license/epl-1-0/</url> | ||
</license> | ||
</licenses> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
(ns automaton-core.configuration.environment | ||
(:require #?@(:clj [[clojure.edn :as edn]] | ||
:cljs [[cljs.reader :as edn] [goog.object :as obj]]) | ||
[automaton-core.configuration.protocol :as core-conf-prot] | ||
[automaton-core.utils.keyword :as utils-keyword] | ||
[clojure.string :as str])) | ||
|
||
#?(:cljs (def ^:private nodejs? (exists? js/require))) | ||
|
||
#?(:cljs (def ^:private process (when nodejs? (js/require "process")))) | ||
|
||
(defn env-key-path | ||
"Turns key-path ([:a :b :c] -> 'a-b-c') into environment type key." | ||
[key-path] | ||
(let [path-str (str/join "-" (map name key-path))] (when-not (str/blank? path-str) (utils-keyword/keywordize path-str)))) | ||
|
||
(defn parse-number | ||
[^String v] | ||
(try #?(:clj (Long/parseLong v) | ||
:cljs (parse-long v)) | ||
#?(:clj (catch NumberFormatException _ (BigInteger. v))) | ||
(catch #?(:clj Exception | ||
:cljs js/Error) | ||
_ | ||
v))) | ||
|
||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} | ||
(defn parse-system-env | ||
"Turns string type into number. In case of failure in parsing it's returned in a format as it was (a string)." | ||
[v] | ||
(cond (re-matches #"[0-9]+" v) (parse-number v) | ||
(re-matches #"^(true|false)$" v) #?(:clj (Boolean/parseBoolean v) | ||
:cljs (parse-boolean v)) | ||
(re-matches #"\w+" v) v | ||
:else (try (let [parsed (edn/read-string v)] (if (symbol? parsed) v parsed)) | ||
(catch #?(:clj Exception | ||
:cljs js/Error) | ||
_ | ||
v)))) | ||
|
||
(defn read-all | ||
"Reads all system env properties and converts to appropriate type." | ||
[] | ||
(->> #?(:clj (System/getenv) | ||
:cljs (if process (let [env (.-env process)] (zipmap (obj/getKeys env) (obj/getValues env))) {})) | ||
(map (fn [[k v]] [(utils-keyword/keywordize k) v])) | ||
(into {}))) | ||
|
||
(def ^{:doc "A map of configuration variables."} conf (memoize read-all)) | ||
|
||
(defrecord EnvConf [] | ||
core-conf-prot/Conf | ||
(read-conf-param [_this key-path] (get (conf) (env-key-path key-path))) | ||
(config [_this] (conf))) |
Oops, something went wrong.