@colyseus/tools 0.16.18 → 0.17.0

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.
@@ -1,47 +0,0 @@
1
- /**
2
- * Monkey-patch for PM2's ActionMethods.js
3
- * Adds custom methods like updateProcessConfig without modifying the original file.
4
- */
5
- 'use strict';
6
-
7
- const Utility = require('../Utility');
8
-
9
- // Import the original ActionMethods module
10
- const originalActionMethods = require('./ActionMethods_orig.js');
11
-
12
- module.exports = function(God) {
13
- // Apply original ActionMethods
14
- originalActionMethods(God);
15
-
16
- /**
17
- * Update process configuration without restart.
18
- * Merges opts.env.current_conf into proc.pm2_env.
19
- * @method updateProcessConfig
20
- * @param {Object} opts - { id: pm_id, env: { current_conf: { ... } } }
21
- * @param {Function} cb
22
- */
23
- God.updateProcessConfig = function updateProcessConfig(opts, cb) {
24
- var id = opts.id;
25
-
26
- if (typeof(id) === 'undefined')
27
- return cb(God.logAndGenerateError('opts.id not passed to updateProcessConfig', opts));
28
- if (!(id in God.clusters_db))
29
- return cb(God.logAndGenerateError('Process id unknown'), {});
30
-
31
- const proc = God.clusters_db[id];
32
-
33
- if (!proc || !proc.pm2_env)
34
- return cb(God.logAndGenerateError('Process not found or missing pm2_env'), {});
35
-
36
- // Merge env into pm2_env.env
37
- if (opts.env) {
38
- Utility.extend(proc.pm2_env, opts.env);
39
- Utility.extend(proc.pm2_env.env, opts.env); // why both?
40
- }
41
-
42
- // Merge current_conf directly into pm2_env
43
- Utility.extendExtraConfig(proc, opts);
44
-
45
- return cb(null, Utility.clone(proc.pm2_env));
46
- };
47
- };
File without changes