Files
xen-orchestra/packages/xo-server-test-plugin/README.md

58 lines
1.2 KiB
Markdown
Raw Normal View History

2016-05-27 17:03:03 +02:00
# xo-server-test-plugin
## Install
Either in xo-server's directory:
```
> npm i vatesfr/xo-server-test-plugin
```
Or globally:
```
> npm i -g vatesfr/xo-server-test-plugin
```
2016-11-04 13:42:23 +01:00
## Documentation
2016-11-04 15:47:45 +01:00
### Plugin life cyle
2016-11-04 13:42:23 +01:00
2016-11-04 15:47:45 +01:00
#### Initialization
2016-11-04 13:42:23 +01:00
2016-11-09 15:53:16 +01:00
When xo-server starts, it initializes plugins.
2016-11-04 13:42:23 +01:00
2016-11-09 15:53:16 +01:00
#### Loading plugins
2016-11-04 13:42:23 +01:00
2016-11-09 15:53:16 +01:00
After initializing the plugins, the xo-server load them.
2016-11-04 13:42:23 +01:00
2016-11-09 15:53:16 +01:00
#### Test
2016-11-04 13:42:23 +01:00
2016-11-09 15:53:16 +01:00
XO clients send data to xo-server for testing the configuration and saving it if successful.
2016-11-04 13:42:23 +01:00
### Principal Methods
#### The default export
It is just a factory function which will create an instance of the plugin. Usually it will be called only once, at startup.
Its only parameter is an object which currently only contains the instance of the currently running xo-server.
2016-11-04 15:47:45 +01:00
#### `configure(configuration) `
2016-11-04 13:42:23 +01:00
2016-11-04 15:47:45 +01:00
This method is called each time the plugin is (re-)configured.
Its only parameter is an object which contains the configuration values.
2016-11-09 15:53:16 +01:00
2016-11-04 15:47:45 +01:00
#### `load() `
2016-11-04 13:42:23 +01:00
This method is called to load the plugin.
2016-11-04 15:47:45 +01:00
#### `unload() `
2016-11-04 13:42:23 +01:00
This method is called to unload the plugin.
2016-11-04 15:47:45 +01:00
#### `test(data) `
2016-11-04 13:42:23 +01:00
This method is called if the test option is activated.
2016-11-04 15:47:45 +01:00
Its only parameter is an object which contains the test values.
2016-11-04 13:42:23 +01:00