Skip to content

Commit

Permalink
fix(docs): process.env.* gets replaced by CLI and it shouldn't #15921
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Aug 17, 2023
1 parent 7a7296f commit f8b4582
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ if (process.env.MODE !== 'ssr' || process.env.PROD) {
)
)
}

```

## Configuring Manifest File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ return {
manualPostHydrationTrigger: false,

prodPort: 3000, // The default port that the production server should use
// (gets superseded if process.env.PORT is specified at runtime)
// (gets superseded if processenvPORT is specified at runtime)

middlewares: [
'render' // keep this as last one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Notice that your generated `/src-ssr` contains a file named `server.js`. This fi
The `/src-ssr/server.[js|ts]` file is a simple JavaScript/Typescript file which boots up your SSR webserver and defines what how your webserver starts & handles requests and what it exports (if exporting anything).

::: danger
The `/src-ssr/server.[js|ts]` file is used for both DEV and PROD, so please be careful on how you configure it. To differentiate between the two states you can use `process.env.DEV` and `process.env.PROD`.
The `/src-ssr/server.[js|ts]` file is used for both DEV and PROD, so please be careful on how you configure it. To differentiate between the two states you can use `processenvDEV` and `processenvPROD`.
:::

``` js
Expand Down Expand Up @@ -164,7 +164,7 @@ Detailing the Object:
{
app, // Expressjs app instance (or whatever you return from create())

port, // on production: process.env.PORT or quasar.config file > ssr > prodPort
port, // on production: processenvPORT or quasar.config file > ssr > prodPort
// on development: quasar.config file > devServer > port

isReady, // Function to call returning a Promise
Expand Down Expand Up @@ -228,7 +228,7 @@ export function create (/* { ... } */) {
### Listen on a port
This is the default option that you get when adding SSR support in a Quasar CLI project. It starts listening on the configured port (process.env.PORT or quasar.config file > ssr > prodPort).
This is the default option that you get when adding SSR support in a Quasar CLI project. It starts listening on the configured port (processenvPORT or quasar.config file > ssr > prodPort).
``` js
// src-ssr/server.[js|ts]
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/quasar-cli-vite/handling-process-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Using `process.env` can help you in many ways:

## Values provided by Quasar CLI

| `process.env.<name>` | Type | Meaning |
| `processenv<name>` | Type | Meaning |
| --- | --- | --- |
| `DEV` | Boolean | Code runs in development mode |
| `PROD` | Boolean | Code runs in production mode |
Expand All @@ -31,7 +31,7 @@ if (process.env.DEV) {
console.log(`I'm on a development build`)
}

// process.env. MODE is the <mode> in
// processenvMODE is the <mode> in
// "quasar dev/build -m <mode>"
// (defaults to 'spa' if -m parameter is not specified)

Expand Down Expand Up @@ -113,7 +113,7 @@ module.exports = function (ctx) {
}
```

Then, in your website/app, you can access `process.env. API`, and it will point to one of those two links above, depending on dev or production build type.
Then, in your website/app, you can access `processenvAPI`, and it will point to one of those two links above, depending on dev or production build type.

You can even combine it with values from the `quasar dev/build` env variables:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ return {
manualPostHydrationTrigger: false,

prodPort: 3000, // The default port that the production server should use
// (gets superseded if process.env.PORT is specified at runtime)
// (gets superseded if processenvPORT is specified at runtime)

maxAge: 1000 * 60 * 60 * 24 * 30,
// Tell browser when a file from the server should expire from cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Detailing the Object:
{
app, // Expressjs app instance

port, // process.env.PORT or quasar.config file > ssr > prodPort
port, // processenvPORT or quasar.config file > ssr > prodPort

isReady, // Function to call returning a Promise
// when app is ready to serve clients
Expand Down
8 changes: 4 additions & 4 deletions docs/src/pages/quasar-cli-webpack/handling-process-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Accessing `process.env` can help you in many ways:

## Values supplied by Quasar CLI

| `process.env.<name>` | Type | Meaning |
| `processenv<name>` | Type | Meaning |
| --- | --- | --- |
| `DEV` | Boolean | Code runs in development mode |
| `PROD` | Boolean | Code runs in production mode |
Expand All @@ -27,7 +27,7 @@ if (process.env.DEV) {
console.log(`I'm on a development build`)
}

// process.env. MODE is the <mode> in
// processenvMODE is the <mode> in
// "quasar dev/build -m <mode>"
// (defaults to 'spa' if -m parameter is not specified)

Expand Down Expand Up @@ -106,7 +106,7 @@ module.exports = function (ctx) {
}
```

Then in your website/app you can access `process.env. API` and it's gonna point to one of those two links above, based on dev or production build type.
Then in your website/app you can access `processenvAPI` and it's gonna point to one of those two links above, based on dev or production build type.

You can even go one step further. Supply it with values taken from the `quasar dev/build` env variables:

Expand Down Expand Up @@ -151,7 +151,7 @@ If you want to be able to override what's inside `.env` or want to make the `.en
```js
// quasar.config file

// This will load from `.env` if it exists, but not override existing `process.env.*` values
// This will load from `.env` if it exists, but not override existing `processenv*` values
require('dotenv').config()

// process.env now contains the terminal variables and the ones from the .env file
Expand Down

0 comments on commit f8b4582

Please sign in to comment.