修改set envs逻辑

This commit is contained in:
hanhh 2021-08-03 18:45:24 +08:00
parent eba78ca84f
commit d8587b64a5

View File

@ -211,14 +211,16 @@ export default class EnvService {
const envs = await this.envs( const envs = await this.envs(
'', '',
{ position: -1 }, { position: -1 },
{ status: { $ne: EnvStatus.disabled }, name: { $exists: true } }, { name: { $exists: true } },
); );
const groups = _.groupBy(envs, 'name'); const groups = _.groupBy(envs, 'name');
let env_string = ''; let env_string = '';
for (const key in groups) { for (const key in groups) {
if (Object.prototype.hasOwnProperty.call(groups, key)) { if (Object.prototype.hasOwnProperty.call(groups, key)) {
const group = groups[key]; const group = groups[key];
env_string += `export ${key}="${_.map(group, 'value') env_string += `export ${key}="${_(group)
.filter((x) => x.status !== EnvStatus.disabled)
.map('value')
.join('&') .join('&')
.replace(/ /g, '')}"\n`; .replace(/ /g, '')}"\n`;
} }