import { } from "@effection-contrib/deno-deploy"
Deno Deploy
Provides Deno Deploy Effection context with region
, deploymentId
and
isDenoDeploy
flag to detect when running in the Deno Deploy environment. This
can be useful when testing an application that's deployed to Deno Deploy.
API
interface DenoDeploy {
- isDenoDeploy: boolean;
True when running in Deno Deploy
- deploymentId: string | undefined;
ID of the current Deno Deploy environment
- region: string | undefined;
It holds the region code of the region in which the deployment is running. You can use this variable to serve region-specific content. You can refer to the region code from the regions page.
const DenoDeployContext: Context<DenoDeploy>
Context used to access DenoDeploy value
function*() {
const {
isDenoDeploy,
deploymentId,
region
} = yield* DenoDeployContext;
}
function* initDenoDeploy(): Operation<DenoDeploy>
Use at the root of your application to setup Deno Deploy context.
import { main } from "effection";
import { initDenoDeploy } from "@effection-contrib/deno-deploy";
await main(function*() {
yield* initDenoDeploy();
});
function* useDenoDeploy(): Operation<DenoDeploy>
Use to read the values of Deno Deploy Context.
import { useDenoDeploy } from "@effection-contrib/deno-deploy";
function* () {
const { isDenoDeploy } = yield* useDenoDeploy();
}