(PM2, module_name, cb)
| 165 | } |
| 166 | |
| 167 | function start(PM2, module_name, cb) { |
| 168 | var module_path = path.join(cst.DEFAULT_MODULE_PATH, module_name); |
| 169 | Common.printOut(cst.PREFIX_MSG_MOD + 'Starting TAR module ' + module_name); |
| 170 | var package_json_path = path.join(module_path, 'package.json'); |
| 171 | var module_conf = Configuration.getSync(`${cst.MODULE_CONF_PREFIX_TAR}:${module_name}`) |
| 172 | |
| 173 | try { |
| 174 | var conf = require(package_json_path) |
| 175 | } catch(e) { |
| 176 | Common.printError(`Could not find package.json as ${package_json_path}`) |
| 177 | return cb() |
| 178 | } |
| 179 | |
| 180 | var opts = {}; |
| 181 | |
| 182 | opts.started_as_module = true |
| 183 | opts.cwd = module_path |
| 184 | |
| 185 | if (module_conf.install_url) |
| 186 | opts.install_url = module_conf.install_url |
| 187 | |
| 188 | if (needPrefix(conf)) |
| 189 | opts.name_prefix = module_name |
| 190 | |
| 191 | PM2.start(conf, opts, function(err, data) { |
| 192 | if (err) { |
| 193 | Common.printError(`Could not start ${module_name} ${module_path}`) |
| 194 | return cb() |
| 195 | } |
| 196 | |
| 197 | Common.printOut(`${cst.PREFIX_MSG_MOD} Module ${module_name} STARTED`) |
| 198 | return cb(); |
| 199 | }) |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Retrieve from module package.json the name of each application |
nothing calls this directly
no test coverage detected
searching dependent graphs…