Package Parameters in OpenWhisk
You can set parameters on the commandline individually, like this:
wsk package update mypackage -p dbname awesomedb
This gets clunky once you have a few parameters, and you can’t add new parameters, whatever you use here will remove any previous params and overwrite. Instead I like to hold the parameters in a file, and edit it and update the action as needed.
Pro tip: you probably don’t want to store the parameters file in source control! Feed it to your deployment toolchain.
Parameters files should be formatted something like this (it’s JSON)
{
"slackURL": "https://hooks.slack.com/services/blah/blah",
"cloudantURL": "https://wibble-squeak-bluemix.cloudant.com",
"dbname": "awesomedb"
}
Then to supply this file (called params.json
) to the package:
wsk package update mypackage -P params.json
(that’s an uppercase P
not the lowercase one as in the earlier example)
You can use this approach to more easily repeat existing parameters, and just add/change what you need to.
Pro-tip: wondering what parameters are already set on this package? Use wsk package get mypackage parameters
to see :)