Skip to content

Instantly share code, notes, and snippets.

@dir
Last active December 1, 2025 21:09
Show Gist options
  • Select an option

  • Save dir/0d560ebc7c76709399db3d2a7c813591 to your computer and use it in GitHub Desktop.

Select an option

Save dir/0d560ebc7c76709399db3d2a7c813591 to your computer and use it in GitHub Desktop.
@t3-oss/t3-env Presets (Zod)
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";
/**
* Biome Environment Variables
*
* @see https://biomejs.dev/reference/environment-variables
*/
export const biome = (): Readonly<{
/**
* A prefix that’s added to the name of the log.
*
* @default "server.log"
*/
BIOME_LOG_PREFIX_NAME?: string;
/**
* The directory where the Daemon logs will be saved.
*/
BIOME_LOG_PATH?: string;
/**
* A path to the configuration file
*/
BIOME_CONFIG_PATH?: string;
/**
* Overrides the Biome binary being used. This allows you, for example, to use a system-wide Biome binary.
*
* If you don’t define this variable, Biome will automatically detect the correct binary for your platform.
*/
BIOME_BINARY?: string;
}> =>
createEnv({
server: {
BIOME_LOG_PREFIX_NAME: z.string().optional(),
BIOME_LOG_PATH: z.string().optional(),
BIOME_CONFIG_PATH: z.string().optional(),
BIOME_BINARY: z.string().optional(),
},
runtimeEnv: process.env,
});
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";
/**
* Cloud Run jobs (GCP) Environment Variables
*
* @see https://docs.cloud.google.com/run/docs/container-contract#jobs-env-vars
*/
export const cloudRunJobs = (): Readonly<{
/**
* The name of the Cloud Run job being run.
*
* @example "hello-world"
*/
CLOUD_RUN_JOB?: string;
/**
* The name of the Cloud Run job execution being run.
*
* @example "hello-world-abc"
*/
CLOUD_RUN_EXECUTION?: string;
/**
* The index of this task.
*
* Starts at `0` for the first task and increments by `1` for every successive task, up to the maximum
* number of tasks minus `1`. If you set `--parallelism` to greater than `1`, tasks might not follow
* the index order. For example, it would be possible for task `2` to start before task `1`.
*/
CLOUD_RUN_TASK_INDEX?: number;
/**
* The number of times this task has been retried.
*
* Starts at `0` for the first attempt and increments by `1` for every successive retry, up to the
* maximum retries value.
*/
CLOUD_RUN_TASK_ATTEMPT?: number;
/*
* The number of tasks defined in the `--tasks` parameter.
*/
CLOUD_RUN_TASK_COUNT?: number;
}> =>
createEnv({
server: {
CLOUD_RUN_JOB: z.string().optional(),
CLOUD_RUN_EXECUTION: z.string().optional(),
CLOUD_RUN_TASK_INDEX: z.coerce.number().int().optional(),
CLOUD_RUN_TASK_ATTEMPT: z.coerce.number().int().optional(),
CLOUD_RUN_TASK_COUNT: z.coerce.number().int().optional(),
},
runtimeEnv: process.env,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment