Skip to content

Instantly share code, notes, and snippets.

@mweagle
Created April 25, 2016 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mweagle/42a840c12d1606c97ebb4afc8f983109 to your computer and use it in GitHub Desktop.
Save mweagle/42a840c12d1606c97ebb4afc8f983109 to your computer and use it in GitHub Desktop.
// Return a string representation of a JS function call that can be exposed
// to AWS Lambda
func createNewNodeJSProxyEntry(lambdaInfo *LambdaAWSInfo, logger *logrus.Logger) string {
logger.WithFields(logrus.Fields{
"FunctionName": lambdaInfo.lambdaFnName,
}).Info("Registering Sparta function")
// We do know the CF resource name here - could write this into
// index.js and expose a GET localhost:9000/lambdaMetadata
// which wraps up DescribeStackResource for the running
// lambda function
primaryEntry := fmt.Sprintf("exports[\"%s\"] = createForwarder(\"/%s\");\n",
lambdaInfo.jsHandlerName(),
lambdaInfo.lambdaFnName)
return primaryEntry
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment