Links

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.
Click here for an example of how a config.json looks

Config File Elements

  • 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 same type 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.
Note on Public_meta & Meta and their requirements
  • Prescript: The prescript object holds two fields, install, and run. 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, the run feature is not enabled.
Note on Prescript
  • Postscript: The postscript object holds the field run. run is a bash script that runs after the plugin is enabled. Currently, the run 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 and public_meta
To see an example of how these elements are used in a real plugin example check the hello-exchange walkthrough below.
To continue with the next section on how to make endpoints and server-side coding, click here.

Plugin Walkthrough - 'hello-exchange' Config

Make sure to familiarize yourself with each of the objects and what they do in the list above
With our hello-exchange plugin initialized we should start building theconfig.json file with all the basic information needed.
  1. 1.
    Create a file called config.json inside the server/ directory of the newly-created hello-exchange plugin. I did this in Visual Studio simply by right-clicking in the server folder and adding a new file.
  2. 2.
    Copy and paste the following code into this newly created file:
Click here for the config.json code for hello-exchange
The newly created config.json in the server folder of hello-exchange
And that's all for what we need to do on this page!
Continue onto the next step, or read below for a bit more understanding of what this new config.json is doing.

What Did We Just Do?

Looking at the interesting bits of the config.json we can see what we have actually defined.
Check the list at the top of the page, for definitions of each element in the config
{
"name": "hello-exchange",
"version": 1,
"type": null,
"author": "HollaEx",
"bio": "Say hello from an exchange",
"description": "Demo plugin for proof of concept",
...
}
The top part of the code we see above is fairly simple. We have defined the name, version, and author of the plugin (hello-exchange, on version 1, written by HollaEx), as well as created its bio - a quick description, and the description - a more detailed description seen on the plugins page.
Documentation, logo, icon, and url are all set to null at the moment so we will ignore them for now.
{
...
"public_meta": {
"public_message": {
"type": "string",
"required": false,
"description": "Not a secret",
"value": "Hello Exchange!"
}
},
"meta": {
"private_message": {
"type": "string",
"required": false,
"description": "A secret",
"value": "hello exchange..."
}
},
...
}
Moving to the next code chunk, we find public-meta and meta.
The list at the top of this page will give the general details and use of public-meta and meta, make sure to try to understand as these are the core of the plugin.
So for hello-exchange we have one object within both public-meta and meta, public-message and private_message respectively, both being fairly similar.
  • type : This defines the (surprisingly) type of the object, out of four allowed types (see above for details). In hello-exchange, both public-meta and meta objects will be strings
  • required : Neither of these values are strictly required for our plugin to run
  • description is the description of the values, here we are reminded that public-meta is not a secret and meta is a secret object. Note: this does not define whether or not the object is a secret or not, this is just a string description only for our examples, it could be any string.
  • value : Here we find the strings our plugin will actually use. In our case Hello Exchange! will be viewable on the public web view, while only the admin will be able to see hello Exchange...
{
...
"prescript": {
"install": ["hello-world-npm"],
"run": null
},
"postscript": {
"run": null
}
...
}
At the end of our code, we have the prescript and postscript. In hello-exchange all that will be installed is the hello-world-npm package, before the plugin is live.
To continue with the next section on how to make endpoints and actual server-side coding, check out the next section.