This utility lets you programatically deploy couchbase eventing functions based on your local folder structure.
This utility lets you programatically deploy couchbase eventing functions based on your local folder structure.
For now its just a POC but it works! and it gets you out of trying to interact with their web UI which is . . . lacking.
For now its just a POC but it works! and it gets you out of trying to interact with their web UI which is . . . lacking.
Basically we're just setting up a folder with some functions in it, where each file corresponds to an eventing function name [like the ones listed here](http://128.146.12.34:8091/ui/index.html#!/eventing/summary)
Then when you want to update one, you make changes to that file and run the importDeploy script with the function (and file) name as an arg. It'll find the new code and post it
to the server and take care of importing/deploying/undeploying for you.
## Quickstart
- fill out the config (./config.js) which for now just uses YOUR login for couchbase
- Run this from the command line with two arguments: function name (or file name without '.js') and operation mode (true = update, false = create):
Example: `node couchbase_eventing getErrors true`
Please check out the `example_function.js` and in general please do not break anything
## Known issues
- UI 'Edit Javascript' stickiness
One of the serveral reasons I made this thing: if you go [here](http://128.146.12.34:8091/ui/index.html#!/eventing/summary) you can sit and watch the UI report 'status' updates
on the eventing/summary page, but even after it finishes (status = deployed) you still need to refresh the page in order to see the new code. Meaning - if you want to double
check that your thing is out there, make sure to refresh the page!
- NO inline n1ql queries!
(For now, see below)
## Todo
- inline n1ql queries
- allow user to specify path to function file in CLI (get rid of assumed folder structure?)
- change login to use some 'system' account not our 'user' logins