@whyour/qinglong 0.21.0 → 0.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyour/qinglong",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
5
5
  "repository": {
6
6
  "type": "git",
package/shell/share.sh CHANGED
@@ -74,7 +74,9 @@ init_env() {
74
74
 
75
75
  import_config() {
76
76
  [[ -f $file_config_user ]] && . $file_config_user
77
- [[ -f $file_env ]] && . $file_env
77
+ if [[ $LOAD_ENV != 'false' ]] && [[ -f $file_env ]]; then
78
+ . $file_env
79
+ fi
78
80
 
79
81
  ql_base_url=${QlBaseUrl:-"/"}
80
82
  ql_port=${QlPort:-"5700"}
@@ -35,6 +35,8 @@ const uploadPath = path_1.default.join(dataPath, 'upload/');
35
35
  const sshdPath = path_1.default.join(dataPath, 'ssh.d/');
36
36
  const systemLogPath = path_1.default.join(dataPath, 'syslog/');
37
37
  const envFile = path_1.default.join(configPath, 'env.sh');
38
+ const jsEnvFile = path_1.default.join(configPath, 'env.js');
39
+ const pyEnvFile = path_1.default.join(configPath, 'env.py');
38
40
  const confFile = path_1.default.join(configPath, 'config.sh');
39
41
  const crontabFile = path_1.default.join(configPath, 'crontab.list');
40
42
  const authConfigFile = path_1.default.join(configPath, 'auth.json');
@@ -81,6 +83,8 @@ exports.default = {
81
83
  sampleFile,
82
84
  confFile,
83
85
  envFile,
86
+ jsEnvFile,
87
+ pyEnvFile,
84
88
  dbPath,
85
89
  uploadPath,
86
90
  configPath,
@@ -93,6 +97,8 @@ exports.default = {
93
97
  'crontab.list',
94
98
  'dependence-proxy.sh',
95
99
  'env.sh',
100
+ 'env.js',
101
+ 'env.py',
96
102
  'token.json',
97
103
  ],
98
104
  writePathList: [configPath, scriptPath],
@@ -193,6 +193,8 @@ let EnvService = class EnvService {
193
193
  });
194
194
  const groups = (0, groupBy_1.default)(envs, 'name');
195
195
  let env_string = '';
196
+ let js_env_string = '';
197
+ let py_env_string = 'import os\n';
196
198
  for (const key in groups) {
197
199
  if (Object.prototype.hasOwnProperty.call(groups, key)) {
198
200
  const group = groups[key];
@@ -204,10 +206,19 @@ let EnvService = class EnvService {
204
206
  .replace(/'/g, "'\\''")
205
207
  .trim();
206
208
  env_string += `export ${key}='${value}'\n`;
209
+ const _env_value = `'${group
210
+ .map((x) => x.value)
211
+ .join('&')
212
+ .replace(/\\/g, '\\\\')
213
+ .replace(/'/g, "\\'")}'`;
214
+ js_env_string += `process.env.${key}=${_env_value};\n`;
215
+ py_env_string += `os.environ['${key}']=${_env_value}\n`;
207
216
  }
208
217
  }
209
218
  }
210
219
  await fs.writeFile(config_1.default.envFile, env_string);
220
+ await fs.writeFile(config_1.default.jsEnvFile, js_env_string);
221
+ await fs.writeFile(config_1.default.pyEnvFile, py_env_string);
211
222
  }
212
223
  };
213
224
  EnvService = __decorate([