mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
---
|
|
title: Configure a private registry for an organization scope with bun install
|
|
sidebarTitle: Configure a scoped registry
|
|
mode: center
|
|
---
|
|
|
|
Private registries can be configured using either [`.npmrc`](/pm/npmrc) or [`bunfig.toml`](/runtime/bunfig#install-registry). While both are supported, we recommend using **bunfig.toml** for enhanced flexibility and Bun-specific options.
|
|
|
|
To configure a registry for a particular npm scope:
|
|
|
|
```toml bunfig.toml icon="settings"
|
|
[install.scopes]
|
|
# as a string
|
|
"@myorg1" = "https://usertitle:password@registry.myorg.com/"
|
|
|
|
# as an object with username/password
|
|
# you can reference environment variables
|
|
"@myorg2" = {
|
|
username = "myusername",
|
|
password = "$npm_pass",
|
|
url = "https://registry.myorg.com/"
|
|
}
|
|
|
|
# as an object with token
|
|
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }
|
|
|
|
```
|
|
|
|
---
|
|
|
|
Your `bunfig.toml` can reference environment variables. Bun automatically loads environment variables from `.env.local`, `.env.[NODE_ENV]`, and `.env`. See [Docs > Environment variables](/runtime/environment-variables) for more information.
|
|
|
|
```toml bunfig.toml icon="settings"
|
|
[install.scopes]
|
|
"@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }
|
|
```
|
|
|
|
---
|
|
|
|
See [Docs > Package manager](/pm/cli/install) for complete documentation of Bun's package manager.
|