Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
"prefer-const": 1, // 4 errors
"no-unused-vars": 1, // 3 errors
"no-use-before-define": 1, // 7 errors
"one-var": 1, // 8 errors
"one-var": 2, // 8 errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the line completely and it will use the default value from airbnb-base (which is error also)

"consistent-return": 1, // 8 errors
"no-param-reassign": 1, // 2 errors
"global-require": 1, // 2 errors
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Generate a key
*/
const keygen = function () {
const Keys = require('../keys'),
keys = new Keys();
const Keys = require('../keys');
const keys = new Keys();

keys.create((err, key) => {
if (err) return console.error(err);
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/showkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Show current key
*/
const showkey = function () {
const Keys = require('../keys'),
keys = new Keys();
const Keys = require('../keys');
const keys = new Keys();

keys.getLocal((err, key) => {
if (err) return console.error(err);
Expand Down
28 changes: 10 additions & 18 deletions lib/cli/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const createServer = require('./createserver');
* Start the server
*/
const start = function (file) {
let port = program.port,
host = program.host || '127.0.0.1',
dbname = program.dbname || '-deployd',
mongoPort = generatePort(),
env = program.environment || process.env.DPD_ENV || 'development',
retries = 0,
credentials = {};
let port = program.port;
const host = program.host || '127.0.0.1';
const dbname = program.dbname || '-deployd';
let mongoPort = '27017';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once your other PR has been merged, you can change this into const

const env = program.environment || process.env.DPD_ENV || 'development';
let retries = 0;
const credentials = {};


if (!port) {
Expand Down Expand Up @@ -98,9 +98,9 @@ const start = function (file) {

if (program.host) {
if (program.auth) {
const auth = program.auth.split(':'),
username = auth[0],
password = auth[1];
const auth = program.auth.split(':');
const username = auth[0];
const password = auth[1];
setCredentials(username, password);
} else if (program.username || program.password) {
setCredentials(program.username, program.password);
Expand Down Expand Up @@ -170,14 +170,6 @@ const start = function (file) {
}
};

/**
* Port generation
*/
function generatePort() {
const portRange = [3000, 9000];
return Math.floor(Math.random() * (portRange[1] - portRange[0])) + portRange[0];
}

function checkForUpdates() {
http.get('http://registry.npmjs.org/deployd-cli', (err, res, body) => {
if (!err) {
Expand Down
8 changes: 4 additions & 4 deletions lib/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Keys.prototype.generate = function () {
*/

Keys.prototype.create = function (fn) {
const key = this.generate(),
keys = this;
const key = this.generate();
const keys = this;

this.readFile((err, data) => {
if (err) return fn(err);
Expand All @@ -54,8 +54,8 @@ Keys.prototype.create = function (fn) {

Keys.prototype.readFile = function (fn) {
fs.readFile(this.path, 'utf-8', (err, data) => {
let jsonData,
error;
let jsonData;
let error;

try {
jsonData = (data && JSON.parse(data)) || {};
Expand Down
Loading