Sanity Library Reference Docs
    Preparing search index...

    Interface StudioEnvVariablesOptions

    The params for the getStudioEnvironmentVariables function that gets Studio focused environment variables.

    interface StudioEnvVariablesOptions {
        envFile?: false | { envDir?: string; mode: string };
        jsonEncode?: boolean;
        prefix?: string;
    }
    Index

    Properties

    envFile?: false | { envDir?: string; mode: string }

    When specified includes environment variables from dotenv files (.env), in the same way the studio does. A mode must be specified, usually development or production, which will load the corresponding .env.development or .env.production. To specify where to look for the dotenv files, specify options.envFile.envDir.

    jsonEncode?: boolean

    When specified, JSON-encodes the values, which is handy if you want to pass this to a bundlers hardcoded defines, such as Vite's define or Webpack's DefinePlugin.

    prefix?: string

    When specified adds a prefix to the environment variable keys, eg: getStudioEnvironmentVariables({prefix: 'process.env.'})