File tree Expand file tree Collapse file tree 3 files changed +28
-9
lines changed
Expand file tree Collapse file tree 3 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -157,3 +157,22 @@ config({
157157Remember, if ` yarn cedar dev ` is already running, your local app won't reflect
158158any changes you make to your ` .env ` file until you stop and re-run
159159` yarn cedar dev ` .
160+
161+ ## Pre-defined Environment Variables
162+
163+ Cedar provides a few pre-defined environment variables that you can use in your
164+ app (this list is a work in progress):
165+
166+ - ` RWJS_API_URL ` : URL or absolute path to your api-server. This is mapped from
167+ ` apiUrl ` in your ` cedar.toml ` file.
168+ - ` RWJS_API_GRAPHQL_URL ` : The URL of the GraphQL API server. Mapped from
169+ ` apiGraphQLUrl ` in ` cedar.toml ` .
170+ - ` CEDAR_DELAY_API_RESTART ` : Cedar's api server rebuilds all code and
171+ auto-restarts as soon as it detects a change in the codebase. Cedar debounces
172+ this to avoid excessive rebuilds/restarts when multiple files are changed at
173+ once. By default, the debounce delay is 500ms, but you can adjust it with the
174+ ` CEDAR_DELAY_API_RESTART ` environment variable.
175+ - ` RWJS_CWD ` : Lets you control the working directory of your app. Mostly used
176+ when working on the framework itself, not when building a Cedar app.
177+ - ` CFW_PATH ` : Used together with the ` cfw ` bin. Also mostly used when working on
178+ the framework itself, not when building a Cedar app.
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ class BuildManager {
1515 this . shouldRebuild = true
1616 this . shouldClean = false
1717 this . buildFn = buildFn
18+ // TODO: Remove process.env.RWJS_DELAY_RESTART in next major release
19+ const delay =
20+ process . env . CEDAR_DELAY_API_RESTART || process . env . RWJS_DELAY_RESTART
1821 this . debouncedBuild = debounce (
1922 async ( options : BuildAndRestartOptions ) => {
2023 // Use flags with higher precedence to determine if we should rebuild or clean
@@ -29,14 +32,11 @@ class BuildManager {
2932 this . shouldClean = false
3033 }
3134 } ,
32- // We want to delay execution when multiple files are modified on the filesystem,
33- // this usually happens when running RedwoodJS generator commands.
34- // Local writes are very fast, but writes in e2e environments are not,
35- // so allow the default to be adjusted with an env-var.
36- //
37- process . env . RWJS_DELAY_RESTART
38- ? parseInt ( process . env . RWJS_DELAY_RESTART , 10 )
39- : 500 ,
35+ // We want to delay execution when multiple files are modified on the
36+ // filesystem. This usually happens when running Cedar generator commands.
37+ // Local writes are very fast, but writes in e2e environments are not, so
38+ // allow the default to be adjusted with an env-var.
39+ delay ? parseInt ( delay , 10 ) : 500 ,
4040 )
4141 }
4242
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ const runDevServerInBackground = () => {
140140 shell : true ,
141141 stdio : 'inherit' ,
142142 env : {
143- RWJS_DELAY_RESTART : '500' ,
143+ CEDAR_DELAY_API_RESTART : '500' ,
144144 REDWOOD_CI : '1' ,
145145 } ,
146146 } )
You can’t perform that action at this time.
0 commit comments