diff --git a/CHANGELOG.md b/CHANGELOG.md index 0549c635d..b10d7b4a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -125,7 +125,7 @@ ## 2.51.3 -- feat(scf-plugin) 支持 MALAGU_APP_ID 环境变量 +- feat(scf-plugin) 支持 CELL_APP_ID 环境变量 ## 2.51.2 @@ -596,7 +596,7 @@ cell: ## 2.24.0 -- feat(config) 新增 @celljs/config 组件,用于提供运行时的配置属性方式。包含以下运行时配置属性策略:通过环境变量 MALAGU_PROPS_FILE 配置属性文件位置和尝试从 process.cwd() 和 __dirname 目录下加载 cell.yml 和 cell.yaml 配置文件 +- feat(config) 新增 @celljs/config 组件,用于提供运行时的配置属性方式。包含以下运行时配置属性策略:通过环境变量 CELL_PROPS_FILE 配置属性文件位置和尝试从 process.cwd() 和 __dirname 目录下加载 cell.yml 和 cell.yaml 配置文件 ## 2.23.3 @@ -763,7 +763,7 @@ cell: ## 2.16.0 - feat(cli) 支持根命令参数 `--props-dir` 和 `--props-file`,用于指定额外的自定义属性文件位置,优先级比项目级别的属性文件高,方便开发者透传属性配置 -- fix(cli) 把全局属性配置文件改为全局配置目录,基于环境变量 `GLOBAL_MALAGU_PROPS_DIR_PATH` 自定义,默认是 `~/.cell` +- fix(cli) 把全局属性配置文件改为全局配置目录,基于环境变量 `GLOBAL_CELL_PROPS_DIR_PATH` 自定义,默认是 `~/.cell` ## 2.15.2 @@ -808,7 +808,7 @@ cell: ## 2.13.0 -- feat(cli + cli-common) 支持全局配置文件,默认全局配置文件路径为: `~/.cell/cell.yml`,可以通过环境变量自定义:`GLOBAL_MALAGU_CONFIG_PATH` +- feat(cli + cli-common) 支持全局配置文件,默认全局配置文件路径为: `~/.cell/cell.yml`,可以通过环境变量自定义:`GLOBAL_CELL_CONFIG_PATH` - feat(cli + cli-common) 支持配置属性 `projectPath`,可以在配置文件中指定项目的真正工作目录,该配置项只在命令行的工作目录的配置文件有效 ## 2.12.0 @@ -1021,7 +1021,7 @@ cell: - feat(framework) 优化 `cell` 框架的默认构建目录 - fix(cli) 优化 `cell init` 命令初始化模板后没有正确安装依赖包 -- fix(cli-common) 提供环境变量 `MALAGU_PROJECT_DIST_PATH` 配置项目构建目录 +- fix(cli-common) 提供环境变量 `CELL_PROJECT_DIST_PATH` 配置项目构建目录 ## 2.5.2 @@ -1044,8 +1044,8 @@ cell: ## 2.4.4 -- feat(cli-common) 提供 `MALAGU_CONFIG_FILE_ALIAS` 环境变量方式配置,优先级比配置文件高 -- feat(cli) 提供 `MALAGU_BANNER` 环境变量方式配置,优先级比配置文件高 +- feat(cli-common) 提供 `CELL_CONFIG_FILE_ALIAS` 环境变量方式配置,优先级比配置文件高 +- feat(cli) 提供 `CELL_BANNER` 环境变量方式配置,优先级比配置文件高 - fix(cloud-plugin) 修复 `profile.credentials.token` 赋值 - fix(*-plugin) 优化日志输出和自定义域名配置 @@ -1454,7 +1454,7 @@ cell: ## v1.18.6 -- feat(fc-adapter) support `MALAGU_DOMAIN` environment variables +- feat(fc-adapter) support `CELL_DOMAIN` environment variables ## v1.18.5 diff --git a/cloud-packages/faas-adapter/src/node/credentials-provider.ts b/cloud-packages/faas-adapter/src/node/credentials-provider.ts index 35cda991b..6b23af010 100644 --- a/cloud-packages/faas-adapter/src/node/credentials-provider.ts +++ b/cloud-packages/faas-adapter/src/node/credentials-provider.ts @@ -11,9 +11,9 @@ export class FaaSCredentialsProvider extends DefaultCredentialsProvider { return credentials; } return { - accessKeyId: process.env.MALAGU_ACCESS_KEY_ID!, - accessKeySecret: process.env.MALAGU_ACCESS_KEY_SECRET!, - token: process.env.MALAGU_TOKEN + accessKeyId: process.env.CELL_ACCESS_KEY_ID!, + accessKeySecret: process.env.CELL_ACCESS_KEY_SECRET!, + token: process.env.CELL_TOKEN }; } diff --git a/cloud-packages/faas-adapter/src/node/regin-provider.ts b/cloud-packages/faas-adapter/src/node/regin-provider.ts index f85b30d66..d5787da00 100644 --- a/cloud-packages/faas-adapter/src/node/regin-provider.ts +++ b/cloud-packages/faas-adapter/src/node/regin-provider.ts @@ -10,6 +10,6 @@ export class FaaSRegionProvider extends DefaultRegionProvider { if (region) { return region; } - return process.env.MALAGU_REGION; + return process.env.CELL_REGION; } } diff --git a/dev-packages/cli-common/src/package/component-package-loader.ts b/dev-packages/cli-common/src/package/component-package-loader.ts index 169ebc24d..f6b3de4b0 100644 --- a/dev-packages/cli-common/src/package/component-package-loader.ts +++ b/dev-packages/cli-common/src/package/component-package-loader.ts @@ -66,7 +66,7 @@ export class ComponentPackageLoader { protected parseConfigPaths(nodePackage: NodePackage, mode?: string): string[] { const configFileAliases = ComponentUtil.getComponentAlias(nodePackage.keywords); - const configFileAlias = process.env.MALAGU_CONFIG_FILE_ALIAS || this.pkg.settings?.configFileAlias; + const configFileAlias = process.env.CELL_CONFIG_FILE_ALIAS || this.pkg.settings?.configFileAlias; if (configFileAlias) { configFileAliases.push(configFileAlias); } diff --git a/dev-packages/cli-common/src/package/package-protocol.ts b/dev-packages/cli-common/src/package/package-protocol.ts index 87360944c..5f26a8b5c 100644 --- a/dev-packages/cli-common/src/package/package-protocol.ts +++ b/dev-packages/cli-common/src/package/package-protocol.ts @@ -3,7 +3,7 @@ import { Command } from 'commander'; import { Settings } from '../settings/settings-protocol'; import { Framework } from '@celljs/frameworks/lib/detector/detector-protocol'; -export const MALAGU_COMPONENT_SUFFIX = '-component'; +export const CELL_COMPONENT_SUFFIX = '-component'; export type ApplicationLog = (message?: any, ...optionalParams: any[]) => void; @@ -124,6 +124,6 @@ export namespace RawComponentPackage { if (!pck.keywords.includes('cell')) { return false; } - return pck.keywords.some(k => k.endsWith(MALAGU_COMPONENT_SUFFIX)); + return pck.keywords.some(k => k.endsWith(CELL_COMPONENT_SUFFIX)); } } diff --git a/dev-packages/cli-common/src/settings/settings-util.ts b/dev-packages/cli-common/src/settings/settings-util.ts index ac08948ee..4713bfb8b 100644 --- a/dev-packages/cli-common/src/settings/settings-util.ts +++ b/dev-packages/cli-common/src/settings/settings-util.ts @@ -7,7 +7,7 @@ import { DEFAULT_SETTINGS, Settings } from './settings-protocol'; export namespace SettingsUtil { export function getSettingsPath() { - return process.env.MALAGU_SETTINGS_PATH ? process.env.MALAGU_SETTINGS_PATH : path.join(PathUtil.getCellHomePath(), 'settings.yml'); + return process.env.CELL_SETTINGS_PATH ? process.env.CELL_SETTINGS_PATH : path.join(PathUtil.getCellHomePath(), 'settings.yml'); } function doGetSettings(): Settings { diff --git a/dev-packages/cli-common/src/utils/component-util.ts b/dev-packages/cli-common/src/utils/component-util.ts index 628d31baa..c4ceed5e9 100644 --- a/dev-packages/cli-common/src/utils/component-util.ts +++ b/dev-packages/cli-common/src/utils/component-util.ts @@ -1,7 +1,7 @@ import { readFileSync, existsSync } from 'fs-extra'; import * as lockfile from '@yarnpkg/lockfile'; import * as path from 'path'; -import { MALAGU_COMPONENT_SUFFIX } from '../package/package-protocol'; +import { CELL_COMPONENT_SUFFIX } from '../package/package-protocol'; const chalk = require('chalk'); export namespace ComponentUtil { @@ -56,8 +56,8 @@ export namespace ComponentUtil { export function getComponentAlias(keywords: string[] = []): string[] { const keywordsAlias = keywords - .filter(k => k.endsWith(MALAGU_COMPONENT_SUFFIX)) - .map(k => k.substring(0, k.length - MALAGU_COMPONENT_SUFFIX.length)); + .filter(k => k.endsWith(CELL_COMPONENT_SUFFIX)) + .map(k => k.substring(0, k.length - CELL_COMPONENT_SUFFIX.length)); return keywordsAlias.includes('cell') ? keywordsAlias : [ ...keywordsAlias, 'cell' ]; } } diff --git a/dev-packages/cli-common/src/utils/path-util.ts b/dev-packages/cli-common/src/utils/path-util.ts index 4e875cce8..117d8889c 100644 --- a/dev-packages/cli-common/src/utils/path-util.ts +++ b/dev-packages/cli-common/src/utils/path-util.ts @@ -11,8 +11,8 @@ export namespace PathUtil { } export function getProjectDistPath() { - if (process.env.MALAGU_PROJECT_DIST_PATH) { - return path.resolve(process.cwd(), process.env.MALAGU_PROJECT_DIST_PATH); + if (process.env.CELL_PROJECT_DIST_PATH) { + return path.resolve(process.cwd(), process.env.CELL_PROJECT_DIST_PATH); } return path.resolve(getProjectHomePath(), 'dist'); } @@ -41,8 +41,8 @@ export namespace PathUtil { } export function getProjectHomePath() { - if (process.env.MALAGU_PROJECT_HOME_PATH) { - return path.resolve(process.cwd(), process.env.MALAGU_PROJECT_HOME_PATH); + if (process.env.CELL_PROJECT_HOME_PATH) { + return path.resolve(process.cwd(), process.env.CELL_PROJECT_HOME_PATH); } let keywords = []; const packageJsonPath = path.resolve(process.cwd(), 'package.json'); @@ -56,31 +56,31 @@ export namespace PathUtil { } export function getProjectConfigPath() { - return process.env.MALAGU_PROJECT_CONFIG_PATH ? path.resolve(process.cwd(), process.env.MALAGU_PROJECT_CONFIG_PATH) : path.resolve(getProjectHomePath(), 'project.json'); + return process.env.CELL_PROJECT_CONFIG_PATH ? path.resolve(process.cwd(), process.env.CELL_PROJECT_CONFIG_PATH) : path.resolve(getProjectHomePath(), 'project.json'); } export function setProjectHomePath(projectHomePath: string) { - process.env.MALAGU_PROJECT_HOME_PATH = projectHomePath; + process.env.CELL_PROJECT_HOME_PATH = projectHomePath; } export function getCellHomePath() { - return process.env.MALAGU_HOME_PATH ? process.env.MALAGU_HOME_PATH : path.join(homedir(), '.cell'); + return process.env.CELL_HOME_PATH ? process.env.CELL_HOME_PATH : path.join(homedir(), '.cell'); } export function getGlobalCellPropsDirPath() { - return process.env.GLOBAL_MALAGU_PROPS_DIR_PATH ? process.env.GLOBAL_MALAGU_PROPS_DIR_PATH : getCellHomePath(); + return process.env.GLOBAL_CELL_PROPS_DIR_PATH ? process.env.GLOBAL_CELL_PROPS_DIR_PATH : getCellHomePath(); } export function getRuntimePath(runtime?: string) { if (runtime) { - const basePath = process.env.MALAGU_RUNTIME_PATH ? process.env.MALAGU_RUNTIME_PATH : path.resolve(getCellHomePath(), 'runtimes'); + const basePath = process.env.CELL_RUNTIME_PATH ? process.env.CELL_RUNTIME_PATH : path.resolve(getCellHomePath(), 'runtimes'); return path.resolve(basePath, RuntimeUtil.getVersion(), runtime); } return process.cwd(); } export function getRuntimeRootPath(version?: string) { - const basePath = process.env.MALAGU_RUNTIME_PATH ? process.env.MALAGU_RUNTIME_PATH : path.resolve(getCellHomePath(), 'runtimes'); + const basePath = process.env.CELL_RUNTIME_PATH ? process.env.CELL_RUNTIME_PATH : path.resolve(getCellHomePath(), 'runtimes'); return version ? path.resolve(basePath, RuntimeUtil.getVersion()) : basePath; } diff --git a/dev-packages/cli/src/cell-main.ts b/dev-packages/cli/src/cell-main.ts index ebec761e8..c54e05041 100644 --- a/dev-packages/cli/src/cell-main.ts +++ b/dev-packages/cli/src/cell-main.ts @@ -66,7 +66,7 @@ async function execute() { join(projectPath, '..', '..', '..', 'node_modules') ])); - process.env.MALAGU_RFS = JSON.stringify({ runtime, settings, framework }); + process.env.CELL_RFS = JSON.stringify({ runtime, settings, framework }); const runtimePath = PathUtil.getRuntimePath(runtime); if (runtimePath !== projectPath) { nodePaths.push(join(runtimePath, 'node_modules')); diff --git a/dev-packages/cli/src/cell.ts b/dev-packages/cli/src/cell.ts index 3c677270e..091b78fa3 100644 --- a/dev-packages/cli/src/cell.ts +++ b/dev-packages/cli/src/cell.ts @@ -17,7 +17,7 @@ updateNotifier({ pkg }).notify(); const spinner = ora({ text: chalk.italic.gray('loading command line context...\n'), discardStdin: false }); (async () => { - const { runtime, framework, settings } = JSON.parse(process.env.MALAGU_RFS!); + const { runtime, framework, settings } = JSON.parse(process.env.CELL_RFS!); BannerUtil.print(version, settings, runtime, framework); spinner.start(); diff --git a/dev-packages/cli/src/utils/banner-util.ts b/dev-packages/cli/src/utils/banner-util.ts index 8425bfa40..a331c3592 100644 --- a/dev-packages/cli/src/utils/banner-util.ts +++ b/dev-packages/cli/src/utils/banner-util.ts @@ -17,7 +17,7 @@ export namespace BannerUtil { runtimeStrLine = '\n│'; runtimeStrLine += chalk.yellow.bold(runtimeStr.padStart(20 + Math.floor(runtimeStr.length / 2)).padEnd(40)) + '│'; } - const banner = process.env.MALAGU_BANNER || settings.banner; + const banner = process.env.CELL_BANNER || settings.banner; if (banner) { console.log(banner.replace('{ version }', version).replace('{ runtime }', runtimeStr)); } else { diff --git a/packages/config/src/node/runtime-context-initializer.ts b/packages/config/src/node/runtime-context-initializer.ts index 47c8fbfad..3412abb2c 100644 --- a/packages/config/src/node/runtime-context-initializer.ts +++ b/packages/config/src/node/runtime-context-initializer.ts @@ -8,8 +8,8 @@ import { resolve } from 'path'; export class RuntimeContextInitializer implements ContextInitializer { protected doInitializeForEnv(ctx: ExpressionContext) { - if (process.env.MALAGU_PROPS_FILE) { - const propsFile = resolve(process.cwd(), process.env.MALAGU_PROPS_FILE); + if (process.env.CELL_PROPS_FILE) { + const propsFile = resolve(process.cwd(), process.env.CELL_PROPS_FILE); if (existsSync(propsFile)) { const props = load(readFileSync(propsFile, 'utf-8')); ConfigUtil.merge(ctx, props); diff --git a/packages/security/src/node/cache/cache-protocol.ts b/packages/security/src/node/cache/cache-protocol.ts index 47a7fa4b1..d12fc8c2a 100644 --- a/packages/security/src/node/cache/cache-protocol.ts +++ b/packages/security/src/node/cache/cache-protocol.ts @@ -1,7 +1,7 @@ import { HttpMethod } from '@celljs/http'; export const RequestCache = Symbol('RequestCache'); -export const SAVED_REQUEST = 'MALAGU_SECURITY_SAVED_REQUEST'; +export const SAVED_REQUEST = 'CELL_SECURITY_SAVED_REQUEST'; export interface SavedRequest { redirectUrl: string; diff --git a/plugins/cloud-plugin/src/hooks/profile-provider.ts b/plugins/cloud-plugin/src/hooks/profile-provider.ts index 7b685ac59..0e7da0bf6 100644 --- a/plugins/cloud-plugin/src/hooks/profile-provider.ts +++ b/plugins/cloud-plugin/src/hooks/profile-provider.ts @@ -37,13 +37,13 @@ export class DefaultProfileProvider implements ProfileProvider { protected async getProfileFromEnv(): Promise { return { - region: process.env.MALAGU_REGION, + region: process.env.CELL_REGION, credentials: { - accessKeyId: process.env.MALAGU_ACCESS_KEY_ID, - accessKeySecret: process.env.MALAGU_ACCESS_KEY_SECRET + accessKeyId: process.env.CELL_ACCESS_KEY_ID, + accessKeySecret: process.env.CELL_ACCESS_KEY_SECRET }, account: { - id: process.env.MALAGU_ACCOUNT_ID + id: process.env.CELL_ACCOUNT_ID } }; diff --git a/plugins/fc-plugin/cell-http-mode.yml b/plugins/fc-plugin/cell-http-mode.yml index 5c94e7507..d23d5612d 100644 --- a/plugins/fc-plugin/cell-http-mode.yml +++ b/plugins/fc-plugin/cell-http-mode.yml @@ -11,7 +11,7 @@ cell: authType: anonymous methods: [GET, POST, PUT, DELETE, HEAD, PATCH] customDomain: - name: ${env.MALAGU_DOMAIN || 'auto'} + name: ${env.CELL_DOMAIN || 'auto'} protocol: HTTP certConfig: # certName: xxx diff --git a/plugins/fc-plugin/cell-sample-http-mode.yml b/plugins/fc-plugin/cell-sample-http-mode.yml index d3dec62ba..d81602ed7 100644 --- a/plugins/fc-plugin/cell-sample-http-mode.yml +++ b/plugins/fc-plugin/cell-sample-http-mode.yml @@ -10,7 +10,7 @@ cell: authType: anonymous methods: [GET, POST, PUT, DELETE, HEAD, PATCH] customDomain: - name: ${env.MALAGU_DOMAIN || 'auto'} + name: ${env.CELL_DOMAIN || 'auto'} protocol: HTTP certConfig: # certName: xxx diff --git a/plugins/fc3-plugin/cell-http-mode.yml b/plugins/fc3-plugin/cell-http-mode.yml index 5c94e7507..d23d5612d 100644 --- a/plugins/fc3-plugin/cell-http-mode.yml +++ b/plugins/fc3-plugin/cell-http-mode.yml @@ -11,7 +11,7 @@ cell: authType: anonymous methods: [GET, POST, PUT, DELETE, HEAD, PATCH] customDomain: - name: ${env.MALAGU_DOMAIN || 'auto'} + name: ${env.CELL_DOMAIN || 'auto'} protocol: HTTP certConfig: # certName: xxx diff --git a/plugins/fc3-plugin/cell-sample-http-mode.yml b/plugins/fc3-plugin/cell-sample-http-mode.yml index d3dec62ba..d81602ed7 100644 --- a/plugins/fc3-plugin/cell-sample-http-mode.yml +++ b/plugins/fc3-plugin/cell-sample-http-mode.yml @@ -10,7 +10,7 @@ cell: authType: anonymous methods: [GET, POST, PUT, DELETE, HEAD, PATCH] customDomain: - name: ${env.MALAGU_DOMAIN || 'auto'} + name: ${env.CELL_DOMAIN || 'auto'} protocol: HTTP certConfig: # certName: xxx diff --git a/plugins/python-plugin/src/packager/docker.ts b/plugins/python-plugin/src/packager/docker.ts index be165eed9..769752189 100644 --- a/plugins/python-plugin/src/packager/docker.ts +++ b/plugins/python-plugin/src/packager/docker.ts @@ -34,7 +34,7 @@ export function findTestFile(servicePath: string, options: PythonPluginOptions) } async function tryBindPath(bindPath: string, testFile: string, pluginOptions: PythonPluginOptions) { - const debug = process.env.MALAGU_DEBUG; + const debug = process.env.CELL_DEBUG; const options = [ 'run', '--rm', diff --git a/plugins/scf-plugin/src/hooks/deploy.ts b/plugins/scf-plugin/src/hooks/deploy.ts index 35cd687f2..5500cf94f 100644 --- a/plugins/scf-plugin/src/hooks/deploy.ts +++ b/plugins/scf-plugin/src/hooks/deploy.ts @@ -23,7 +23,7 @@ export default async (context: DeployContext) => { const cloudConfig = CloudUtils.getConfiguration(cfg); const profileProvider = new DefaultProfileProvider(); - const { region, credentials, account, appId = process.env.MALAGU_APP_ID } = await profileProvider.provide(cloudConfig) as (Profile & { appId?: string }); + const { region, credentials, account, appId = process.env.CELL_APP_ID } = await profileProvider.provide(cloudConfig) as (Profile & { appId?: string }); const clients = await createClients(cloudConfig, region, credentials); cosClient = clients.cosClient;