From 600f054098e29291818c1d59b1ac8ca032dc2f34 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Sat, 21 May 2022 22:38:26 +0800 Subject: [PATCH] chore: update config yaml location --- README.md | 4 ++-- dev.yaml => config/dev.yaml | 0 packages/config/lib/index.js | 2 +- packages/config/src/index.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename dev.yaml => config/dev.yaml (100%) diff --git a/README.md b/README.md index e21eb25..a58f80d 100644 --- a/README.md +++ b/README.md @@ -90,11 +90,11 @@ pnpm run dev - 服务接口地址:`http://localhost:5002`。 - 协作接口地址:`http://localhost:5003`。 -如需修改配置,可在 `dev.yaml` 中进行配置。 +如需修改配置,可在 `config/dev.yaml` 中进行配置。 ### 配置文件 -默认加载 `dev.yaml` 中的配置(生产环境使用 `prod.yaml` )。 +默认加载 `config/dev.yaml` 中的配置(生产环境使用 `config/prod.yaml` )。 ```yaml # 开发环境配置 diff --git a/dev.yaml b/config/dev.yaml similarity index 100% rename from dev.yaml rename to config/dev.yaml diff --git a/packages/config/lib/index.js b/packages/config/lib/index.js index 505cda8..43a3927 100644 --- a/packages/config/lib/index.js +++ b/packages/config/lib/index.js @@ -11,7 +11,7 @@ var FILE_ENV_NAME = { }; var env = process.env.NODE_ENV || 'development'; function getConfig() { - var filePath = path.join(__dirname, '../../../', "".concat(FILE_ENV_NAME[env], ".yaml")); + var filePath = path.join(__dirname, '../../../config', "".concat(FILE_ENV_NAME[env], ".yaml")); if (!fs.existsSync(filePath)) { throw new Error("Can not find config file: ".concat(filePath)); } diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index 3283328..11016ed 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -11,7 +11,7 @@ const FILE_ENV_NAME = { const env = process.env.NODE_ENV || 'development'; export function getConfig() { - const filePath = path.join(__dirname, '../../../', `${FILE_ENV_NAME[env]}.yaml`); + const filePath = path.join(__dirname, '../../../config', `${FILE_ENV_NAME[env]}.yaml`); if (!fs.existsSync(filePath)) { throw new Error(`Can not find config file: ${filePath}`);