summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Tom Adler <me@arty.name> 2023-07-07 10:45:12 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-07 09:45:12 +0100
commit3153d04dadb2fc7feb893c52bbdcd4d11bb03bf3 (patch)
treee577e1bd0a248d943139e8f452bd7322beadded9
parent6bf20b62ce9f7eaaa1dbec65bb697bb935214f61 (diff)
downloadastro-3153d04dadb2fc7feb893c52bbdcd4d11bb03bf3.tar.gz
astro-3153d04dadb2fc7feb893c52bbdcd4d11bb03bf3.tar.zst
astro-3153d04dadb2fc7feb893c52bbdcd4d11bb03bf3.zip
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>
-rw-r--r--packages/integrations/node/README.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/integrations/node/README.md b/packages/integrations/node/README.md
index eed078bef..4c2f8a389 100644
--- a/packages/integrations/node/README.md
+++ b/packages/integrations/node/README.md
@@ -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
```
+#### 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
### SyntaxError: Named export 'compile' not found