@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
36 lines • 1.01 kB
JavaScript
import { environmentVariables } from '../constants.js';
/**
* Enum that represents the environment to use for a given service.
*
* @readonly
*/
export var Environment;
(function (Environment) {
Environment["Local"] = "local";
Environment["Production"] = "production";
})(Environment || (Environment = {}));
/**
* Returns the environment to use for a given service.
*
* @param env - Environment variables.
* @returns The environment to use for a given service.
*/
export function serviceEnvironment(env = process.env) {
const value = env[environmentVariables.serviceEnv];
if (value === 'local') {
return Environment.Local;
}
else {
return Environment.Production;
}
}
/**
* Returns true if the environment is local.
*
* @param env - Environment variables.
* @returns True if the environment is local.
*/
export function isLocalEnvironment(env = process.env) {
return serviceEnvironment(env) === Environment.Local;
}
//# sourceMappingURL=service.js.map