Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs page about env vars #541

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ This page covers how to set and use environment variables in a sandbox, and defa
## Default environment variables
### Knowing if you are inside a sandbox

<Note>
Sometimes it's useful to know if you are inside a sandbox. Upon creating a sandbox, an environment variable `E2B_SANDBOX` is set to `true`.
</Note>
Sometimes it's useful to know if the code is running inside a sandbox. Upon creating a sandbox, an environment variable `E2B_SANDBOX` is automatically set to `true`.
You can try it out by running the following code in the sandbox:

<CodeGroup>
```js
Expand All @@ -15,7 +14,7 @@ const result = await sandbox.commands.run('echo $E2B_SANDBOX')
```
```python
sandbox = Sandbox()
result = sandbox.run_code("import os; os.getenv('E2B_SANDBOX')")
result = sandbox.commands.run("echo $E2B_SANDBOX")
```
</CodeGroup>

Expand Down
Loading