Runtime environment variables docs for node integration (#7378)
* Runtime environment variables docs for node integration * Update packages/integrations/node/README.md Co-authored-by: Reuben Tier <64310361+TheOtterlord@users.noreply.github.com> * final fixes --------- Co-authored-by: Reuben Tier <64310361+TheOtterlord@users.noreply.github.com>
This commit is contained in:
parent
6bf20b62ce
commit
3153d04dad
1 changed files with 12 additions and 0 deletions
|
@ -172,6 +172,18 @@ You can pass the path to your key and certification via the environment variable
|
||||||
SERVER_KEY_PATH=./private/key.pem SERVER_CERT_PATH=./private/cert.pem node ./dist/server/entry.mjs
|
SERVER_KEY_PATH=./private/key.pem SERVER_CERT_PATH=./private/cert.pem node ./dist/server/entry.mjs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Runtime environment variables
|
||||||
|
|
||||||
|
If an `.env` file containing environment variables is present when the build process is run, these values will be hard-coded in the output, just as when generating a static website.
|
||||||
|
|
||||||
|
During the build, the runtime variables must be absent from the `.env` file, and you must provide Astro with every environment variable to expect at run-time: `VARIABLE_1=placeholder astro build`. This signals to Astro that the actual value will be available when the built application is run. The placeholder value will be ignored by the build process, and Astro will use the value provided at run-time.
|
||||||
|
|
||||||
|
In the case of multiple run-time variables, store them in a seperate file (e.g. `.env.runtime`) from `.env`. Start the build with the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export $(cat .env.runtime) && astro build
|
||||||
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### SyntaxError: Named export 'compile' not found
|
### SyntaxError: Named export 'compile' not found
|
||||||
|
|
Loading…
Reference in a new issue