Deno
Layerfig is compatible with Deno. According to the official Deno documentation, Deno provides polyfills for several built-in Node.js APIs, including those Layerfig uses for file loading (node:path and node:fs).
The library is not yet published to jsr (the Deno package registry). However, since Deno supports npm packages, you can install Layerfig using the following command:
After installation, follow the setup process described in the Getting Started guide.
The main difference when using Deno is its security model, which restricts access by default. Layerfig needs two permissions:
--allow-readto load your configuration files.--allow-envto read the environment, which Layerfig uses for slots andEnvironmentVariableSource.
Reading the environment explicitly
Section titled “Reading the environment explicitly”Layerfig defaults to process.env, which Deno polyfills. If you would rather use Deno’s native API — or you want to grant --allow-env for a specific list of variables — pass runtimeEnv yourself:
With this setup complete, you can load your configuration files and access the config object throughout your application.