Created
April 30, 2019 16:40
-
-
Save thomasmichaelwallace/88fbdbc8ef63d1307c73d53def8f180b to your computer and use it in GitHub Desktop.
squirreldex: config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const lambda = new AWS.lambda(); | |
async function updateSotd(sotd) { | |
// pick one of the 1000 squirrels at random: | |
const id = Math.floor(Math.random() * 1000); | |
// build an environment with the new SD_SOTD value: | |
const Variables = { SD_SOTD: sotd }; | |
const params = { | |
// required: | |
FunctionName: 'squirreldex', | |
// optional, only what needs updating, | |
Environment: { Variables }, | |
}; | |
// and redeploy with the new squirrel of the day configuration: | |
return lambda | |
.updateFunctionConfiguration(params).promise(); | |
} | |
module.exports = { updateSotd }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment