docs(core): set env vars from the command line
Co-authored-by: Muhamed Karajic <muhamedkarajic96@gmail.com>
This commit is contained in:
parent
8c9ad0da69
commit
4ee6ed1f98
@ -101,6 +101,13 @@ Now, when we define variables in our `.env` file, such as...
|
|||||||
NX_API_URL=http://localhost:3333
|
NX_API_URL=http://localhost:3333
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{% callout type="note" title="Set environment variables from the terminal" %}
|
||||||
|
Alternatively, you can set the variable when running a terminal command by using:
|
||||||
|
|
||||||
|
- MacOS & Linux: `NX_API_URL=http://localhost:9999 npm run build-prod`
|
||||||
|
- Windows: `set NX_API_URL=http://localhost:9999 & npm run build-prod`
|
||||||
|
{% /callout %}
|
||||||
|
|
||||||
Finally, We can use environment variables in our code. For example,
|
Finally, We can use environment variables in our code. For example,
|
||||||
|
|
||||||
```typescript {% fileName="apps/myapp/src/main.ts" %}
|
```typescript {% fileName="apps/myapp/src/main.ts" %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user