Using .env.local files with Uniform CLI

Last updated: February 12, 2026

By default, the Uniform CLI only reads environment variables from .env files. If you're using .env.local or other .env.* files, the CLI won't automatically recognize the variables stored in these files.

Workaround for .env.local files

To use variables from .env.local or other .env.* files, you can add file selection logic to your uniform.config.ts file:

import type { CLIConfiguration } from '@uniformdev/cli';
import * as dotenv from 'dotenv';

dotenv.config({ path: `.env.local` });

const config: CLIConfiguration = {
  // your configuration here
}

This approach manually loads the environment variables from your .env.local file before the CLI configuration is processed.

This requires dotenv dependency to be installed with npm install dotenv --save-dev

Alternative solution

If you prefer not to modify your configuration file, you can rename your .env.local file to .env, which the CLI will read automatically.

You can also continue to pass the project ID and API key directly as command line parameters:

npm run uniform:pull --project="your-project-id" --apiKey="your-api-key" --config="uniform.config.ts"