diff options
author | 2023-10-02 17:52:29 -0700 | |
---|---|---|
committer | 2023-10-02 17:52:29 -0700 | |
commit | 63a00791faac5636394f38f540f79d2e452b6b65 (patch) | |
tree | 769afaaff6710d3bf636fd7c60991ed482784562 | |
parent | a6af1c89b954c56493d457d33b7f066e1f195afa (diff) | |
download | bun-63a00791faac5636394f38f540f79d2e452b6b65.tar.gz bun-63a00791faac5636394f38f540f79d2e452b6b65.tar.zst bun-63a00791faac5636394f38f540f79d2e452b6b65.zip |
Update development and document env var expansion
-rw-r--r-- | docs/project/development.md | 24 | ||||
-rw-r--r-- | docs/runtime/env.md | 40 |
2 files changed, 40 insertions, 24 deletions
diff --git a/docs/project/development.md b/docs/project/development.md index d08e201b7..6963df434 100644 --- a/docs/project/development.md +++ b/docs/project/development.md @@ -375,35 +375,13 @@ $ valgrind --fair-sched=try --track-origins=yes bun-debug <args> ## Updating `WebKit` -The Bun team will occasionally bump the version of WebKit used in Bun. When this happens, you may see something like this with your run `git status`. - -```bash -$ git status -On branch my-branch -Changes not staged for commit: - (use "git add <file>..." to update what will be committed) - (use "git restore <file>..." to discard changes in working directory) - modified: src/bun.js/WebKit (new commits) -``` - -For performance reasons, `make submodule` does not automatically update the WebKit submodule. To update, run the following commands from the root of the Bun repo: +The Bun team will occasionally bump the version of WebKit used in Bun. When this happens, you may see errors in `src/bun.js/bindings` during builds. When you see this, install the latest version of `bun-webkit` and re-compile. ```bash $ bun install $ make cpp ``` -<!-- Check the [Bun repo](https://github.com/oven-sh/bun/tree/main/src/bun.js) to get the hash of the commit of WebKit is currently being used. - -{% image width="270" src="https://github.com/oven-sh/bun/assets/3084745/51730b73-89ef-4358-9a41-9563a60a54be" /%} --> - -<!-- -```bash -$ cd src/bun.js/WebKit -$ git fetch -$ git checkout <hash> -``` --> - ## Troubleshooting ### 'span' file not found on Ubuntu diff --git a/docs/runtime/env.md b/docs/runtime/env.md index 7fcfd98aa..e38eabffd 100644 --- a/docs/runtime/env.md +++ b/docs/runtime/env.md @@ -25,9 +25,47 @@ Or programmatically by assigning a property to `process.env`. process.env.FOO = "hello"; ``` +### Quotation marks + +Bun supports double quotes, single quotes, and + +### Expansion + +Environment variables are automatically _expanded_. This means you can reference previously-defined variables in your environment variables. + +```txt#.env +FOO=world +BAR=hello$FOO +``` + +```ts +process.env.BAR; // => "helloworld" +``` + +This is useful for constructing connection strings or other compound values. + +```txt#.env +DB_USER=postgres +DB_PASSWORD=secret +DB_HOST=localhost +DB_PORT=5432 +DB_URL=postgres://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME +``` + +This can be disabled by escaping the `$` with a backslash. + +```txt#.env +FOO=world +BAR=hello\$FOO +``` + +```ts +process.env.BAR; // => "hello$FOO" +``` + ### `dotenv` -Generally speaking, you won't need `dotenv` anymore, because Bun reads `.env` files automatically. +Generally speaking, you won't need `dotenv` or `dotenv-expand` anymore, because Bun reads `.env` files automatically. ## Reading environment variables |