0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 02:28:18 -05:00

Allow to set features by config file

This commit is contained in:
Andrés Moya 2022-07-29 10:54:52 +02:00
parent 0667089833
commit f4482eb5a7
2 changed files with 18 additions and 6 deletions

View file

@ -63,6 +63,11 @@
flags (sequence (map keyword) (str/words flags))]
(flags/parse flags/default default-flags flags)))
(defn- parse-features
[global]
(when-let [features-str (obj/get global "penpotFeatures")]
(map keyword (str/words features-str))))
(defn- parse-version
[global]
(-> (obj/get global "penpotVersion")
@ -88,6 +93,7 @@
(def build-date (parse-build-date global))
(def flags (atom (parse-flags global)))
(def features (atom (parse-features global)))
(def version (atom (parse-version global)))
(def target (atom (parse-target global)))
(def browser (atom (parse-browser)))

View file

@ -8,6 +8,7 @@
(:require
[app.common.data :as d]
[app.common.logging :as log]
[app.config :as cfg]
[app.main.store :as st]
[okulary.core :as l]
[potok.core :as ptk]
@ -27,7 +28,6 @@
:result (if (not (contains? (:features state) feature))
"enabled"
"disabled"))
(-> state
(update :features
(fn [features]
@ -62,8 +62,14 @@
active-feature? (mf/deref active-feature-ref)]
active-feature?))
;; By default the features are active in local environments
(when *assert*
;; Activate all features in local environment
(doseq [f features-list]
(toggle-feature! f)))
;; Read initial enabled features from config, if set
(if-let [enabled-features @cfg/features]
(doseq [f enabled-features]
(toggle-feature! f))
(when *assert*
;; By default, all features disabled, except in development
;; environment, that are enabled except components-v2
(doseq [f features-list]
(when (not= f :components-v2)
(toggle-feature! f)))))