/** 环境名 */ export type TEnvName = 'production' | 'test' | 'dev' | 'local' | string /** 环境配置 | 接口定义 */ export interface IEnv { /** 环境名, 支持重名, 及 `test1`、`dev1`等 */ name: TEnvName /** 环境启用条件 * @description Request工具根据 rule规则定义, * @type {string} 基于 host 匹配, 当host相同时, 启用. * @type {RegExp} 正则匹配, rule.test(location.href), 使用正则匹配url, 当满足规则时, 使用当前环境配置 * - 示例: //api.server.com/xxx -> /api\.server\.com/ * @type {() => boolean} 自定义环境判断 Factory Function. 当返回值为true时, 启用当前环境 */ rule: string | RegExp | (() => boolean) /** 请求地址前缀 */ baseURL: string /** mock地址 * @description mock地址, 当启用 mock = true 时, 启用 mock 环境 */ mockURL?: string /** 动态代理, 来源路径. 用于本地开发时, 绕过跨域限制 * @description 仅 NODE_ENV==='production' 时, 可用. */ referer?: string /** 环境优先级, 当同时满足多条环境规则时, 根据优先级大小选择环境, 默认则根据环境定义顺序, 选择环境 */ order?: number }