Skip to content
Closed
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ The edge runtime can be divided into two runtimes with different purposes.
- Limits are required to be set such as: Memory and Timeouts.
- Has access to environment variables explictly allowed by the main runtime.

## Configuration

### Environment Variables

- `SUPABASE_FUNCTIONS_PATH` - Custom path for function compilation directory.
- Default: `/var/tmp/sb-compile-<executable-name>` on Unix/Linux, `%TEMP%\sb-compile-<executable-name>` on Windows
- Example: `SUPABASE_FUNCTIONS_PATH=/home/deno/functions` (useful for Kubernetes deployments)

## Developers

To learn how to build / test Edge Runtime, visit [DEVELOPERS.md](DEVELOPERS.md)
Expand Down
18 changes: 12 additions & 6 deletions crates/deno_facade/module_loader/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,18 @@ pub async fn create_module_loader_for_eszip(
.transpose()?
.unwrap_or_default();

let root_path = if cfg!(target_family = "unix") {
PathBuf::from("/var/tmp")
} else {
std::env::temp_dir()
}
.join(format!("sb-compile-{}", current_exe_name));
let root_path = match std::env::var("SUPABASE_FUNCTIONS_PATH") {
Ok(custom_path) => PathBuf::from(custom_path),
Err(_) => {
// Default behavior: use platform-specific temp directory
if cfg!(target_family = "unix") {
PathBuf::from("/var/tmp")
} else {
std::env::temp_dir()
}
.join(format!("sb-compile-{}", current_exe_name))
}
};

let node_modules = metadata.node_modules()?;
let root_dir_url =
Expand Down