New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

egg-cluster

Package Overview
Dependencies
Maintainers
5
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-cluster - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

.eslintignore

6

History.md
0.1.0 / 2016-08-16
==================
* feat: [BREAKING_CHANGE] master won't load config (#4)
* test: add test cases (#3)
0.0.4 / 2016-07-16

@@ -3,0 +9,0 @@ ==================

1

lib/agent_worker.js

@@ -16,3 +16,2 @@ 'use strict';

plugins: options.plugins,
customEgg: options.customEgg,
});

@@ -19,0 +18,0 @@ agent.ready(() => process.send({ action: 'agent-start', to: 'master' }));

@@ -11,3 +11,2 @@ 'use strict';

const app = new Application({
customEgg: options.customEgg,
baseDir: options.baseDir,

@@ -14,0 +13,0 @@ plugins: options.plugins,

@@ -13,3 +13,2 @@ 'use strict';

const MasterLoader = require('./utils/loader');
const parseOptions = require('./utils/options');

@@ -26,9 +25,8 @@ const Messenger = require('./utils/messenger');

* @param {Object} options
* - {String} [eggPath] - egg framework path
* - {String} [customEgg] - customized egg framework, default to `eggPath`
* - {String} [baseDir] application code directory, default to `process.cwd()`
* - {Object} [plugins] - customized plugins, for test purpose
* - {String} [customEgg] - directory of framework
* - {String} [baseDir] directory of application, default to `process.cwd()`
* - {Object} [plugins] - customized plugins, for unittest
* - {Number} [workers] numbers of app workers, default to `os.cpus().length`
* - {Number} [port] listening port, default to 7001(http) or 8443(https)
* - {Boolean} [https] https or hot
* - {Boolean} [https] https or not
* - {String} [key] ssl key

@@ -44,16 +42,9 @@ * - {String} [cert] ssl cert

const loader = new MasterLoader(this.options);
const config = loader.loadConfig();
this.isProduction = config.env !== 'local' && config.env !== 'unittest';
this.isProduction = isProduction();
// app started or not
this.isStarted = false;
this.logger = new ConsoleLogger({ level: 'INFO' });
this.logger = new ConsoleLogger({
errorFile: path.join(config.logger.dir, config.logger.errorLogName),
level: 'INFO',
encoding: config.logger.encoding,
});
// get the real framework info
const frameworkPath = options.customEgg || options.eggPath;
const frameworkPath = options.customEgg;
const frameworkPkg = require(path.join(frameworkPath, 'package.json'));

@@ -357,1 +348,9 @@

}
function isProduction() {
const serverEnv = process.env.EGG_SERVER_ENV;
if (serverEnv) {
return serverEnv !== 'local' && serverEnv !== 'unittest';
}
return process.env.NODE_ENV === 'production';
}

@@ -10,7 +10,5 @@ 'use strict';

customEgg: '',
eggPath: '',
baseDir: process.cwd(),
port: options.https ? 8443 : 7001,
workers: null,
antxpath: '',
plugins: null,

@@ -26,11 +24,7 @@ https: false,

assert(options.eggPath && fs.existsSync(options.eggPath), 'options.eggPath should exists');
const egg = require(options.eggPath);
assert(options.customEgg && fs.existsSync(options.customEgg), 'options.customEgg is required');
const egg = require(options.customEgg);
assert(egg.Application, 'should define Application in customEgg');
assert(egg.Agent, 'should define Agent in customEgg');
if (!options.customEgg) {
options.customEgg = options.eggPath;
}
if (options.https) {

@@ -37,0 +31,0 @@ assert(options.key && fs.existsSync(options.key), 'options.key should exists');

{
"name": "egg-cluster",
"version": "0.0.4",
"version": "0.1.0",
"description": "cluster manager for egg",
"main": "index.js",
"scripts": {
"test": "egg-bin test",
"test": "npm run lint && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint --ext js . --fix",
"ci": "npm run lint && npm run cov",
"autod": "autod"

@@ -26,7 +30,6 @@ },

"dependencies": {
"egg-loader": "^0.0.2",
"egg-logger": "^1.0.0",
"cfork": "^1.5.1",
"cluster-reload": "^1.0.2",
"debug": "^2.2.0",
"egg-logger": "^1.2.0",
"get-ready": "^1.0.0",

@@ -36,7 +39,13 @@ "sendmessage": "^1.0.5"

"devDependencies": {
"autod": "^2.6.1",
"egg-bin": "^1.0.1",
"autod": "^2.7.0",
"coffee": "^3.2.4",
"egg": "*",
"egg-bin": "^1.2.0",
"egg-ci": "^1.0.2",
"eslint": "^3.0.1",
"eslint-config-egg": "^3.0.1"
"egg-mock": "*",
"eslint": "^3.3.1",
"eslint-config-egg": "^3.1.0",
"pedding": "^1.0.0",
"should": "^10.0.0",
"supertest": "^1.2.0"
},

@@ -43,0 +52,0 @@ "engines": {

@@ -1,2 +0,2 @@

# egg-logger
# egg-cluster

@@ -23,3 +23,3 @@ [![NPM version][npm-image]][npm-url]

Egg cluster.
Cluster Manager for Egg

@@ -36,6 +36,34 @@ ---

TBD
```js
const startCluster = require('egg-cluster').startCluster;
startCluster({
baseDir: '/path/to/app',
customEgg: '/path/to/framework',
});
```
You can specify a callback that will be invoked when application has started. However, master process will exit when catch an error.
```js
startCluster(options, () => {
console.log('started');
});
```
## Options
| Param | Type | Description |
| --------- | --------- | ------------------------ |
| baseDir | `String` | directory of application |
| customEgg | `String` | directory of framework |
| plugins | `Object` | plugins for unittest |
| workers | `Number` | numbers of app workers |
| port | `Number` | port |
| https | `Boolean` | start a https server |
| key | `String` | ssl key |
| cert | `String` | ssl cert |
## License
[MIT](LICENSE)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc