Update ports

This commit is contained in:
bamurtaugh
2021-04-19 12:21:28 -07:00
parent 7f2315806a
commit 0239c9cf05
2 changed files with 5 additions and 5 deletions

View File

@@ -21,11 +21,11 @@
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [3000], // "forwardPorts": [3000],
// Use 'portsAttributes' to set default properties for specific forwarded ports. // Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
// You can use a port number (i.e. 3000), range of numbers, or a regex to match the running process.
"portsAttributes": { "portsAttributes": {
".+/server.js": { "3000": {
"label": "Hello Remote World" "label": "Hello Remote World",
"onAutoForward": "notify"
} }
}, },

View File

@@ -64,7 +64,7 @@ Some things to try:
**Open browser automatically:** As an example change, let's update the `portsAttributes` in the `.devcontainer/devcontainer.json` file to open a browser when our port is automatically forwarded. **Open browser automatically:** As an example change, let's update the `portsAttributes` in the `.devcontainer/devcontainer.json` file to open a browser when our port is automatically forwarded.
- Open the `.devcontainer/devcontainer.json` file. - Open the `.devcontainer/devcontainer.json` file.
- Modify your `portsAttributes` to include a new attribute (you can add it underneath the `label` attribute): `"onAutoForward": "openBrowser"`. - Modify the `"onAutoForward"` attribute in your `portsAttributes` from `"notify"` to `"openBrowser"`.
- Press <kbd>F1</kbd> and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up. - Press <kbd>F1</kbd> and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
## Contributing ## Contributing