File tree Expand file tree Collapse file tree 5 files changed +6
-63
lines changed Expand file tree Collapse file tree 5 files changed +6
-63
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ Configuration can be done on multiple levels (later overrides former levels):
6
6
7
7
1 . defaults
8
8
2 . compiler options
9
- 3 . environmental variables
10
- 4 . programmatically
9
+ 3 . programmatically
11
10
12
11
### Configuration via defaults
13
12
@@ -37,22 +36,6 @@ For example:
37
36
This overrides default ` :features-to-install ` , sets custom ` :fn-symbol ` and instructs cljs-devtools to print overridden config
38
37
values during installation.
39
38
40
- ### Configuration via environmental variables
41
-
42
- We use [ binaryage/env-config] ( https://github.com/binaryage/env-config ) library to allow configuration overrides via
43
- environmental variables. Common prefix for our configuration variables is ` CLJS_DEVTOOLS ` .
44
-
45
- For example, in a Bash shell you can do this to achieve configuration matching the config map above:
46
-
47
- lein clean
48
- env CLJS_DEVTOOLS/FN_SYMBOL=F \
49
- CLJS_DEVTOOLS/PRINT_CONFIG_OVERRIDES=true \
50
- CLJS_DEVTOOLS/FEATURES_TO_INSTALL="~[:formatters :hints]" \
51
- lein cljsbuild once
52
-
53
- Please note that environmental variables are retrieved during compilation in a macro expansion. So proper environment must
54
- be present during ClojureScript compilation and you have to clear compilation caches after changing the environment.
55
-
56
39
### Programmatic configuration
57
40
58
41
When [ installed manually] ( https://github.com/binaryage/cljs-devtools/blob/master/docs/installation.md#install-it-manually ) ,
Original file line number Diff line number Diff line change 10
10
:url " https://github.com/binaryage/cljs-devtools" }
11
11
12
12
:dependencies [[org.clojure/clojure " 1.10.1" :scope " provided" ]
13
- [org.clojure/clojurescript ~clojurescript-version :scope " provided" ]
14
- [binaryage/env-config " 0.2.2" ]]
13
+ [org.clojure/clojurescript ~clojurescript-version :scope " provided" ]]
15
14
16
15
:clean-targets ^{:protect false } [" target"
17
16
" test/resources/.compiled" ]
60
59
:preloads [devtools.testenv]
61
60
:optimizations :none
62
61
:checked-arrays :warn }}
63
- :tests-with-config
64
- {:source-paths [" src/lib"
65
- " test/src/tests" ]
66
- :compiler {:output-to " test/resources/.compiled/tests-with-config/build.js"
67
- :output-dir " test/resources/.compiled/tests-with-config"
68
- :asset-path " .compiled/tests-with-config"
69
- :main devtools.main
70
- :optimizations :none
71
- :checked-arrays :warn
72
- :external-config {:devtools/config {:features-to-install [:hints ]
73
- :fn-symbol " F"
74
- :print-config-overrides true }}
75
- :preloads [devtools.testenv devtools.preload]}} ; CLJS-1688
76
62
:dead-code
77
63
{:source-paths [" src/lib"
78
64
" test/src/dead-code" ]
171
157
:aliases {" test" [" do"
172
158
[" clean" ]
173
159
[" test-tests" ]
174
- [" test-tests-with-config" ]
175
160
[" test-dead-code" ]
176
161
; ["test-dce-size"]
177
162
[" test-advanced-warning" ]]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
(ns devtools.prefs
2
- (:require [env-config.core :as env-config]
3
- [cljs.env]))
2
+ (:require [cljs.env]))
4
3
5
4
; see https://github.com/binaryage/cljs-devtools/blob/master/docs/configuration.md
6
5
17
16
18
17
; -- environmental config ---------------------------------------------------------------------------------------------------
19
18
20
- (def ^:dynamic env-config-prefix " cljs-devtools" )
21
-
22
19
(defn get-env-vars []
23
20
(-> {}
24
21
(into (System/getenv ))
25
22
(into (System/getProperties ))))
26
23
27
- (defn read-env-config []
28
- (env-config/make-config-with-logging env-config-prefix (get-env-vars )))
29
-
30
- (def memoized-read-env-config (memoize read-env-config))
31
-
32
- (defmacro emit-env-config []
33
- `'~(or (memoized-read-env-config ) {}))
34
-
35
24
; -- macro config api -------------------------------------------------------------------------------------------------------
36
25
37
26
(defn read-config []
38
- (merge ( memoized- read-env-config ) ( read- external-config) ))
27
+ (read-external-config ))
39
28
40
29
(def memoized-read-config (memoize read-config))
41
30
Original file line number Diff line number Diff line change 1
1
(ns devtools.prefs
2
- (:require-macros [devtools.prefs :refer [emit-external-config emit-env-config ]])
2
+ (:require-macros [devtools.prefs :refer [emit-external-config]])
3
3
(:require [devtools.defaults :as defaults ]))
4
4
5
5
; we use delay for DCE, see https://github.com/binaryage/cljs-devtools/issues/37
6
6
(def default-config (delay @defaults/config))
7
7
(def external-config (delay (emit-external-config )))
8
- (def env-config (delay (emit-env-config )))
9
- (def initial-config (delay (merge @default-config @external-config @env-config)))
8
+ (def initial-config (delay (merge @default-config @external-config)))
10
9
11
10
(def ^:dynamic *current-config* (delay @initial-config))
12
11
You can’t perform that action at this time.
0 commit comments