diff --git a/exporter/src/app/config.cljs b/exporter/src/app/config.cljs index 76da48a1c..eb65382a4 100644 --- a/exporter/src/app/config.cljs +++ b/exporter/src/app/config.cljs @@ -7,6 +7,7 @@ (ns app.config (:refer-clojure :exclude [get]) (:require + [app.common.data :as d] ["process" :as process] [cljs.pprint] [cuerdas.core :as str] @@ -35,20 +36,27 @@ [prefix] (let [env (unchecked-get process "env") kwd (fn [s] (-> (str/kebab s) (str/keyword))) - prefix (str prefix "-") + prefix (str prefix "_") len (count prefix)] (reduce (fn [res key] - (cond-> res - (str/starts-with? key prefix) - (assoc (kwd (subs key len)) - (unchecked-get env key)))) + (let [val (unchecked-get env key) + key (str/lower key)] + (cond-> res + (str/starts-with? key prefix) + (assoc (kwd (subs key len)) val)))) {} (js/Object.keys env)))) +(defn- prepare-config + [] + (let [env (read-env "penpot") + env (d/without-nils env) + data (merge defaults env)] + (us/conform ::config data))) + (def config - (atom (->> (read-env "penpot") - (merge defaults) - (us/conform ::config)))) + (atom (prepare-config))) + (defn get "A configuration getter." diff --git a/exporter/yarn.lock b/exporter/yarn.lock index a122fe7ac..43907db23 100644 --- a/exporter/yarn.lock +++ b/exporter/yarn.lock @@ -11,9 +11,9 @@ regenerator-runtime "^0.13.4" "@types/node@*": - version "15.0.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-15.0.1.tgz#ef34dea0881028d11398be5bf4e856743e3dc35a" - integrity sha512-TMkXt0Ck1y0KKsGr9gJtWGjttxlZnnvDtphxUOSd0bfaR6Q1jle+sPvrzNR1urqYTWMinoKvjKfXUGsumaO1PA== + version "15.0.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-15.0.2.tgz#51e9c0920d1b45936ea04341aa3e2e58d339fb67" + integrity sha512-p68+a+KoxpoB47015IeYZYRrdqMUcpbK8re/zpFB8Ld46LHC1lPEbp3EXgkEhAYEcPvjJF6ZO+869SQ0aH1dcA== "@types/yauzl@^2.9.1": version "2.9.1" @@ -272,9 +272,9 @@ cookies@~0.8.0: keygrip "~1.1.0" core-js-pure@^3.0.0: - version "3.11.2" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.11.2.tgz#10e3b35788c00f431bc0d601d7551475ec3e792c" - integrity sha512-DQxdEKm+zFsnON7ZGOgUAQXBt1UJJ01tOzN/HgQ7cNf0oEHW1tcBLfCQQd1q6otdLu5gAdvKYxKHAoXGwE/kiQ== + version "3.12.1" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.12.1.tgz#934da8b9b7221e2a2443dc71dfa5bd77a7ea00b8" + integrity sha512-1cch+qads4JnDSWsvc7d6nzlKAippwjUlf6vykkTLW53VSV+NkE6muGBToAjEA8pG90cSfcud3JgVmW2ds5TaQ== core-util-is@~1.0.0: version "1.0.2" @@ -492,9 +492,9 @@ get-stream@^5.1.0: pump "^3.0.0" glob@^7.1.3: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -618,9 +618,9 @@ inherits@2.0.3: integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= is-generator-function@^1.0.7: - version "1.0.8" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.8.tgz#dfb5c2b120e02b0a8d9d2c6806cd5621aa922f7b" - integrity sha512-2Omr/twNtufVZFr1GhxjOMFPAj2sjc/dKaIqBhvo4qciXfJmITGH6ZGd8eZYNHza8t1y0e01AuqRhJwfWp26WQ== + version "1.0.9" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.9.tgz#e5f82c2323673e7fcad3d12858c83c4039f6399c" + integrity sha512-ZJ34p1uvIfptHCN7sFTjGibB9/oBg17sHqzDLfuwhvmN/qLVvIQXRQ8licZQ35WJ8KuEQt/etnnzQFI9C9Ue/A== isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" @@ -982,9 +982,9 @@ puppeteer-cluster@^0.22.0: debug "^4.1.1" puppeteer@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-9.1.0.tgz#0530ed1f595088eefd078c8f1f7618d00f216a56" - integrity sha512-+BWwEKYQ9oBTUcDYwfgnVPlHSEYqD4sXsMqQf70vSlTE6YIuXujc7zKgO3FyZNJYVrdrUppy/LLwGF1IRacQMQ== + version "9.1.1" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-9.1.1.tgz#f74b7facf86887efd6c6b9fabb7baae6fdce012c" + integrity sha512-W+nOulP2tYd/ZG99WuZC/I5ljjQQ7EUw/jQGcIb9eu8mDlZxNY2SgcJXTLG9h5gRvqA3uJOe4hZXYsd3EqioMw== dependencies: debug "^4.1.0" devtools-protocol "0.0.869402"