1 | const path = require('path')
|
2 | const getCwd = require('./get-cwd')
|
3 |
|
4 | /**
|
5 | * 获取项目配置文件路径 (默认: /koot.js)
|
6 | * @param {Boolean} portion 是否获取部分配置
|
7 | * @returns {String}
|
8 | */
|
9 | module.exports = (portion = false) => {
|
10 | if (portion) {
|
11 | return typeof process.env.KOOT_PROJECT_CONFIG_PORTION_PATHNAME === 'string'
|
12 | ? process.env.KOOT_PROJECT_CONFIG_PORTION_PATHNAME
|
13 | : path.resolve(getCwd(), 'koot.js')
|
14 | }
|
15 | return typeof process.env.KOOT_PROJECT_CONFIG_FULL_PATHNAME === 'string'
|
16 | ? process.env.KOOT_PROJECT_CONFIG_FULL_PATHNAME
|
17 | : path.resolve(getCwd(), 'koot.js')
|
18 | }
|