Skip to content
Merged
Changes from all 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
7 changes: 4 additions & 3 deletions bin/node-lambda
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ var dotenv = require('dotenv');
var lambda = require('../lib/main.js');
var program = require('commander');
var fs = require('fs');
var packageJsonName = fs.existsSync(process.cwd() + '/package.json')
? require(process.cwd() + '/package.json').name : 'UnnamedFunction';
var packageJson = fs.existsSync(process.cwd() + '/package.json')
? require(process.cwd() + '/package.json') : {};
var packageJsonName = packageJson.name || 'UnnamedFunction';

dotenv.load();

Expand All @@ -21,7 +22,7 @@ var AWS_HANDLER = process.env.AWS_HANDLER || 'index.handler';
var AWS_ROLE = process.env.AWS_ROLE_ARN || process.env.AWS_ROLE || 'missing';
var AWS_MEMORY_SIZE = process.env.AWS_MEMORY_SIZE || 128;
var AWS_TIMEOUT = process.env.AWS_TIMEOUT || 60;
var AWS_DESCRIPTION = process.env.AWS_DESCRIPTION || '';
var AWS_DESCRIPTION = process.env.AWS_DESCRIPTION || packageJson.description || '';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

description is not a required package.json field, so we might want to check if description is in packageJson before trying to load it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it will auto fallback to '' if that is the case.

2016-08-01 20:59 GMT+08:00 Chase notifications@github.com:

In bin/node-lambda
#133 (comment):

@@ -21,7 +22,7 @@ var AWS_HANDLER = process.env.AWS_HANDLER || 'index.handler';
var AWS_ROLE = process.env.AWS_ROLE_ARN || process.env.AWS_ROLE || 'missing';
var AWS_MEMORY_SIZE = process.env.AWS_MEMORY_SIZE || 128;
var AWS_TIMEOUT = process.env.AWS_TIMEOUT || 60;
-var AWS_DESCRIPTION = process.env.AWS_DESCRIPTION || '';
+var AWS_DESCRIPTION = process.env.AWS_DESCRIPTION || packageJson.description || '';

description is not a required package.json field, so we might want to
check if description is in packageJson before trying to load it


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/motdotla/node-lambda/pull/133/files/cd09fb8a638bfd078f5afaee8414d0bb09f4f110#r72973230,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKsHf-CXTOMwd_3jFUwbnlg_2ecZVc6ks5qbe2hgaJpZM4JY7kY
.

Ulion

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yup, you're right. Messing with too many other programming languages made me too strict ^_^

var AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs4.3';
var AWS_PUBLISH = process.env.AWS_PUBLISH || false;
var AWS_FUNCTION_VERSION = process.env.AWS_FUNCTION_VERSION || '';
Expand Down