Authored by 姜枫

hotfix file path add the env

@@ -11,7 +11,9 @@ import md5 from 'md5'; @@ -11,7 +11,9 @@ import md5 from 'md5';
11 import {Hotfix} from '../../models'; 11 import {Hotfix} from '../../models';
12 import qn from '../../../lib/qiniu' 12 import qn from '../../../lib/qiniu'
13 import path from 'path'; 13 import path from 'path';
14 -import Operation from '../../logger/operation'; 14 +import Operation from '../../logger/operation'
  15 +
  16 +const env = process.env.NODE_ENV || 'development';
15 17
16 let r = new Router(); 18 let r = new Router();
17 19
@@ -60,14 +62,14 @@ const hf = { @@ -60,14 +62,14 @@ const hf = {
60 time: new Date() 62 time: new Date()
61 }; 63 };
62 64
63 - let batchKey = `app-hotfix2/${appName}/${type.toLowerCase()}/${appVersion}`; 65 + let batchKey = `app-hotfix2/${env}/${appName}/${type.toLowerCase()}/${appVersion}`;
64 66
65 if (patchVersion) { 67 if (patchVersion) {
66 batchKey = path.join(batchKey, patchVersion); 68 batchKey = path.join(batchKey, patchVersion);
67 } 69 }
68 batchKey = path.join(batchKey, batchFile.name); 70 batchKey = path.join(batchKey, batchFile.name);
69 71
70 - let apiFileKey = `app-hotfix2/${appName}/${type.toLowerCase()}/${appVersion}/api.json`; 72 + let apiFileKey = `app-hotfix2/${env}/${appName}/${type.toLowerCase()}/${appVersion}/api.json`;
71 let batchUpload = await qn.uploadFileAsync(batchFile.path, {key: batchKey}); 73 let batchUpload = await qn.uploadFileAsync(batchFile.path, {key: batchKey});
72 74
73 if (batchUpload && batchUpload.url) { 75 if (batchUpload && batchUpload.url) {
@@ -13,7 +13,7 @@ const defaults = { @@ -13,7 +13,7 @@ const defaults = {
13 const specific = { 13 const specific = {
14 development: {}, 14 development: {},
15 test: {}, 15 test: {},
16 - production: {}, 16 + production: {}
17 }; 17 };
18 18
19 export default Object.assign(defaults, specific[env]); 19 export default Object.assign(defaults, specific[env]);