-
Notifications
You must be signed in to change notification settings - Fork 13
Build your Plugin
NB: To write your own plugin, the best way is to start from an already existing one.
A plugin is a simple node.js lib that modifies the Cozy Light main server configuration and save data to the configuration file.
Mandatory
- configure(options, config, program): It's the function loaded when Cozy Light starts. There you can save parameters given by the Cozy Light platform.
-
options
contains one field: config_path that give the path of the configuration file. -
config
is the Cozy Light config file values. -
program
is the Commander instance use to manage the command lines parameters.
-
Optional
-
configureAppServer(app, config, routes, callback)
: Allows the plugin to modify the main Express server that handles proxying and dashboard rendering.-
app
is the Express application. -
config
is the Cozy Light config file values. -
routes
is the routing table of the proxy that links a name to a port. -
callback
function to call to end the configuration.
-
-
getTemplate()
: Return plugin data to display in the Cozy Light main dashboard. -
onExit(options, config, callback)
: This function is called on the Cozy Light termination and requires thecallback
to be called.-
options
contains one field: config_path that give the path of the configuration file. -
config
is the Cozy Light config file values.
-
A plungin requires an app-like manifest (the only difference is the type which is set to "plugin"):
{
"name": "cozy-light-html5-apps",
"type": "plugin",
"version": "0.1.0",
"displayName": "HTML5 support for Cozy Light",
"description": "Allow to deploy apps only made of static files.",
"author": "Cozy Cloud <contact@cozycloud.cc> (http://cozycloud.cc)",
"licenses": [
{
"type": "AGPL v3",
"url": "http://www.gnu.org/licenses/agpl-3.0.html"
}
],
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/cozy-labs/cozy-light-html5-apps.git"
},
"dependencies": {
"express": "^4.9.0"
}
}
If you want additional details, ask to the community : https://forum.cozy.io