Config
The config.json defines the plugin's general structure. Here we will take a look at what makes up a config file and see how we make one for hello-exchange
The general structure of the plugin is defined in the
config.json
file. Config includes the plugin name, description, icon, etc.The Config is basically a draft of a plugin JSON- the final product. Most items in the config are self-explanatory but below they are fully defined.
When the plugin is initialized, the config.json file will not be created, so it must be added manually. Check the hello-exchange plugin walkthrough at the bottom to see how this process is generally done.
{
"name": "Plugin Name",
"version": 1,
"type": null,
"author": "Author",
"bio": "Short description shown in admin panel",
"description": "Description shown on plugin page",
"documentation": null,
"logo": null,
"icon": null,
"url": null,
"public_meta": {
"public_value": {
...
}
},
"meta": {
"private_value": {
...
}
},
"prescript": {
"install": ["hello-world-npm"],
"run": null
},
"postscript": {
"run": null
}
}
- Name: The name of your plugin must not include spaces and has to be unique from all other plugins installed on your Kit
- Type: The type of this plugin. This value can be set to
null
. If this value is set, no other plugin with the sametype
can be installed. - Version: The version of your plugin is important when it comes to upgrading.
- Bio: The bio is a short description of your plugin that shows in the plugin list on the blue admin panel
- Description: The description is the full description of your plugin shown on the plugin page.
- Author: The author who is shown on the plugin page.
- Public_meta: The public_meta object holds all public values used in the plugin that can be changed while the plugin is running. It should hold values that are publicly available.
- Meta: The meta-object holds all private values used in the plugin that can be changed while the plugin is running. It should hold values for unique keys, secrets, etc.
public_meta
and meta
are variables accessible in the plugin interface on the exchange operator control and they can easily be dynamically set by the exchange operator. Variables like keys should be set in
meta
and variables that you want your public client web view to access should be set in public_meta
.Both the
public_meta
and meta
objects require the keys type
, required
, description
, and value
for each parameter added. type
is the data type of the parameter (onlynumber
,string
,boolean
, anddate-time
are allowed).required
is whether or not the parameter is required for the plugin.description
is the description of the parameter in use.value
is the actual value set for the plugin.
- Prescript: The prescript object holds two fields,
install
, andrun
.install
is an array of strings. Each string is the name of the NPM library the plugin should install before running.run
is a bash script run before the plugin is enabled. Currently, therun
feature is not enabled.
- Postscript: The postscript object holds the field
run
.run
is a bash script that runs after the plugin is enabled. Currently, therun
feature is not enabled. - Script: This is the ES6+ script for your plugin. When enabled, this script will run. The script should be passed as a minified string.
- Web_view: This field will contain the plugin's web client code. You can read more about it in the later Web View Development page here.
- Admin_view: This field will contain the plugin's admin client code. This is HTML code and once added to the plugin there will be a new section added to the left sidebar of the operator control that includes this code. This is used for cases where the admin wants to have more freedom and control over certain actions beyond just configuring
meta
andpublic_meta
To see an example of how these elements are used in a real plugin example check the hello-exchange walkthrough below.
Last modified 6mo ago