Environments

Whenever you create a Livestorm plugin, it is by default shipped without specific environment.

The development environment is the one you should use in the development phase of your plugin.
To be safe, we advise you to use the API key of a test account that you create to test your plugin.

How to get a new environment?

An environment is simply an account you create on which you will publish your plugin.
If you want to test your plugin on a fresh account before releasing it to your users, you can simply create a free Livestorm account which you can use as a test environment.

You can create as many test accounts as you want. You only need to get the API tokens associated with your test accounts and set them into your livestorm.config.js file.

The steps are as follows :

  1. Declare a new environment in your livestorm.config.js file following the below format
  2. Create a free Livestorm account
  3. Go to your new dashboard and generate a token
  4. Paste the token as the value of the apiToken of the created environment

Once finished, you will be able to publish your plugin to your new Livestorm Account. This will then activate the plugin for all of the events that you create with the new account.

Declaring multiple environments

Even though a plugin is shipped with a single environment, you can create as many as you would like.
A good way to set up your plugin is to create at least 2 environments.

To modify/create or delete environments, you simply need to edit your livestorm.config.js file.

{
    "environments": {
        "development": {
            "apiKey": "xxx",
            "name": "xxx"
        },
        "staging": {
            "apiKey": "xxx",
            "name": "xxx"
        },
    }
}

Publishing to an env

Once set up, the environment key in the livestorm.config.js (development, staging, production, anything) is used to publish the plugin to the given account when you publish :

# Default env (it will use the api token specified in the main configuration)
livestorm publish 

# Other env need to be specified manually
livestorm publish development 
livestorm publish staging

Same goes for the watch command :

# will watch and publish to the default env
livestorm watch 

# will watch and publish to staging
livestorm watch staging

Restrict plugin to a specific event

If you desire to activate your plugin only for a specific Event, you can use the scoped_to_even_ids key in your environment configuration.

This is very useful if you designed a plugin for a specific use case. For instance, if you are giving an online course, you might be building a MCQ plugin specific to the event. It won't need to be activated for other internal meetings, or other courses.

For instance :

{
    "environments": {
        "development": {
            "scoped_to_event_ids": [
                "xxx",
                "yyy"
            ],
            "apiToken": "xxx",
            "name": "yyy"
        }
    }
}

By default, a plugin will be activated for all your organization's events.


Did this page help you?