Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Azure Serverless plugin #2

Merged
merged 1 commit into from
Feb 15, 2017
Merged

Azure Serverless plugin #2

merged 1 commit into from
Feb 15, 2017

Conversation

pragnagopa
Copy link
Contributor

No description provided.

@pragnagopa
Copy link
Contributor Author

@worldsoup @ac360 - This is the initial PR which has the core pieces. Once we get this in, will send updates with improvements.

@pragnagopa
Copy link
Contributor Author

Adding @yochay as FYI

@charpeni
Copy link

charpeni commented Feb 3, 2017

@pragnagopa what happened with the semicolons?

@pragnagopa
Copy link
Contributor Author

Fixed semicolons. Auto fixing via Eslint removed them

Copy link

@charpeni charpeni left a comment

Choose a reason for hiding this comment

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

Great work @pragnagopa !

The package.json seems like a generated one ? You could probably clean this.

package.json Outdated
"main": "index.js",
"name": "serverless-azure-functions",
"optionalDependencies": {},
"readme": "# serverless-azure-functions\r\nWIP – Coming soon...\r\n",

Choose a reason for hiding this comment

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

Do we need this if we have the readmeFilename?

module.exports = {
getBindingsMetaData: function (serverless) {
serverless.cli.log(`Parsing Azure Functions Bindings.json...`);
var bindingDisplayNames = [];

Choose a reason for hiding this comment

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

Most of these vars could be const

shared/utils.js Outdated
bindingSettingsNames = parsedBindings['bindingSettingsNames'][bindingTypeIndex];

if (azureSettings) {
for (var j = 0; j < Object.keys(azureSettings).length; j++) {

Choose a reason for hiding this comment

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

Loops should use let instead of var unless you mean to use the variable outside the block scope

package.json Outdated
"bluebird": "^3.4.6",
"chalk": "^1.1.3",
"lodash": "^4.16.6",
"ms-rest-azure": "*",

Choose a reason for hiding this comment

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

not safe to use * versions

Choose a reason for hiding this comment

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

I think the request module is missing from this list, too.

@christopheranderson
Copy link

You ought to be able to set your ESLint settings to warn you about using var - should prefer const or let if you need to assign to a different object.

Also, since we're targeting es6, we might want to add an "engine" version to prevent folks from using older Node versions - ideally folks are using 6.5.0 given that's what we're using in Azure right now.

@mortkarlberg
Copy link

If you need help fixing the code review remarks above or anything else, please let me know. I would love to help with anything to get proper Azure support in Serverless.

this.serverless = serverless;
this.provider = this;
this.serverless.setProvider(constants.providerName, this);
subscriptionId = process.env[this.serverless.service.provider.subscriptionId];
Copy link

@mgarrettm mgarrettm Feb 14, 2017

Choose a reason for hiding this comment

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

This doesn't seem correct. It seems like this used to pull credentials from serverless.yml and then switched to taking them from environment variables, but now instead it kind of does half of both. Environment variables seem better than serverless.yml, because at least it's out of the source, but it's still a worse pattern than the other plugins have. I'm not sure what options there are with Azure credentials, though. Anyways, the way the README currently reads, it seems like

subscriptionId = process.env['azureSubId'];
servicePrincipalTenantId = process.env['azureServicePrincipalTenantId'];
servicePrincipalClientId = process.env['azureservicePrincipalClientId']; // The 's' should probably get capitalized in the README
servicePrincipalPassword = process.env['azureServicePrincipalPassword'];

would be more correct.

@pragnagopa
Copy link
Contributor Author

@mgarrettm - For now using the environment variables for azure credentials, but we are looking into other options to login - command line login , providing a script to setup credentials.

@mgarrettm
Copy link

@pragnagopa - Both of those directions sounds promising, thanks for the update. And thanks for the plugin, Serverless support for Azure is really awesome to see!

@pragnagopa pragnagopa merged commit 87bf175 into serverless:dev Feb 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants