You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+29-1
Original file line number
Diff line number
Diff line change
@@ -58,13 +58,41 @@ npm i --progress=false
58
58
59
59
### Project Structure
60
60
61
-
Source lives in `src/`. Compiled output goes in `dist/`.
61
+
Source lives in `src/`. Compiled output goes in `dist/`. Configuration goes in
62
+
`config/`.
62
63
63
64
#### Source Files
64
65
65
66
-`containers/`: [Stateful][dumb-comp] react components. These are usually top-level route handlers.
66
67
-`components/`: [Stateless/Dumb][dumb-comp] react components. These guys determininstically render based on props.
67
68
69
+
70
+
### Configuration Values
71
+
72
+
Configuration values are stored in the `config/` directory. You gain access to the configuration values by importing the config object from `config/index.js`. The configuration values are loaded as such:
73
+
74
+
1. The values in `config/default.js`
75
+
2. The values in `config/{{APP_ENV}}.js` where `APP_ENV` is an environment variable.
76
+
3. If `APP_ENV` is not set, `config/development.js` will be loaded by default.
77
+
78
+
[the logic for loading the config is here](https://github.com/UTD-CRSS/app.exploreapollo.org/blob/master/config/index.js).
79
+
80
+
#### Example
81
+
82
+
We use the configuration file to determine the API entry point in our actions.
83
+
84
+
1.[import the configuration object](https://github.com/UTD-CRSS/app.exploreapollo.org/blob/a999375d881ed763fd18b852b402582b5a6e647b/src/actions/index.js#L5)
85
+
2.[use the configuration object](https://github.com/UTD-CRSS/app.exploreapollo.org/blob/a999375d881ed763fd18b852b402582b5a6e647b/src/actions/index.js#L31)
86
+
3. If the `APP_ENV` is set to `staging`, [this](https://github.com/UTD-CRSS/app.exploreapollo.org/blob/a999375d881ed763fd18b852b402582b5a6e647b/config/staging.js#L3) will be the value for `config.apiEntry`.
87
+
88
+
Consider the following example commands:
89
+
90
+
```bash
91
+
npm run dev # runs dev server with development API
92
+
APP_ENV=staging npm run dev # runs dev server with staging API
93
+
APP_ENV=production npm run dev # runs dev server with production API
0 commit comments