Development Environment Setup
How you set up your development environment changes depending on what phase of development you’re in. A fully-local setup is all you need for initial work, while full testing and release require a cloud-based setup.
See Extensions Life-Cycle Management for more detail about the various stages of extension development.
Environment Configuration Overview
When working on a Genvid MILE SDK Twitch extension, there are three main phases of development that require changes to the environment you work in:
The following table describes the differences between the development environments defined by Twitch.
Twitch Dev Mode |
Cluster Mode |
Description |
---|---|---|
Local Test |
Local Bastion
Local Cluster
|
You stream to your Twitch account but
develop and test locally.
Requires CORS/SSL for your backend.
|
Hosted Test |
Local Bastion
Remote Cluster
|
You stream to your Twitch account and
host your asset files on Twitch.
Requires CORS/SSL for your backend.
|
Released |
Local Bastion
Remote Cluster
|
You stream to your Twitch account.
Requires CORS/SSL for your backend.
Better scalability.
|
Note
Since the release of the New Extensions policy for Content Security Policy (CSP) directives and timeline for enforcement, when running your extension in either Hosted Test or Released mode, you must add the following endpoints to the Allowlist for URL Fetching Domains under the Capabilities tab of your extension in your developer console:
endpoint |
Config Settings value |
Example |
---|---|---|
Web Endpoint |
twitch/cloud/endpoint/web |
https://<web_endpoint> |
Leaf endpoint |
twitch/cloud/endpoint/leaf |
https://<leaf_endpoint> |
Leaf Endpoint (WebSocket) |
twitch/cloud/endpoint/leaf |
wss://<leaf_endpoint> |
Local Test (Local Bastion / Local Cluster)
See Start a Local Cluster for information on setting up a local cluster.
Once you’ve set up your local cluster, you also need to:
Configure your web backend to use CORS.
Provide an SSL certificate to your web backend.
There are also some additional steps required to configure your environment for developing Twitch Extensions. You need to:
Specify that you want to use the Twitch Streaming Service.
Send your stream to the Twitch Ingest Service (Twitch).
Specify your Twitch Channel ID and Stream Key so you can stream to your account. (You can find these in your Twitch Account.)
You can set all these configuration details using the stream.hcl
file
located in the config
folder. The following table includes all the
variables you need to change.
Environment Variable |
Description |
---|---|
TWITCH_EXT_CHANNEL |
Your Twitch channel name (username). |
TWITCH_EXT_KEY |
Your Twitch account key (located under your ad dashboard and channels). |
TWITCH_SSL |
true if in local test (Twitch), true if in Hosted Test (or live). |
ENDPOINT |
If using a cloud cluster, the DNS URL (without specifying the protocol http/https). This value will be populated automatically. |
TWITCH_EXT_SECRET |
Secret key in your Twitch Extension Application, required for server-side JWT decoding. (Webgateway API) |
Once you update your file, you need to load it into your cluster configuration. For the DirectX Sample, we do that with the directx.py script.
py directx.py load
Hosted Test (Local Bastion / Remote Cluster)
See Terraform Sample for Twitch Extensions for information on setting up a remote cluster.
Once you’ve set up your remote cluster, you also need to:
Configure your web backend to use CORS.
Provide an SSL certificate to your web backend.
Released (Production) (Local Bastion / Remote Cluster)
See Terraform Sample for Twitch Extensions for information on setting up a remote cluster.
Once you’ve set up your remote cluster, you also need to:
Configure your web backend to use CORS.
Provide an SSL certificate to your web backend.
The released version of your Twitch extension needs to be built for scalability. This means that:
Your API calls from your extension to the Twtich API are efficient,
Your API calls to your web backend are efficient, and
Your infrastructure is scalable.