The Compute code editor is available for you to embed in your application, so your customers can build their functions quickly and easily:
The editor is hosted at
https://editor.suborbital.network, and uses URL parameters to configure its connection to your builder service.
You will host the Compute builder service in your cloud infrastructure with a configured DNS name. In order to use the editor, an HTTPS connection to the builder is required.
To launch the editor, you can either embed the editor in a frame within your own webpage, or launch it in a new tab.
To authenticate the editor for a specific user to edit their own functions, the
control-plane service provides an API to create an
editor token for a given function:
When giving your users access to the editor, you must use an authenticated endpoint provided by your application server to fetch a token that is used to authenticate their editing session.
Full details for the token API are described in the API Reference section.
The editor is configured with URL parameters. Here's an example:
Let's break it down:
- This is the URL of your builder service
- The editor token retrieved from the control-plane service
- The identifier used when addressing your specific user, see Fully-qualified function names for more details
- The specific function name that the editor should load
- The function namespace (if not included, the
defaultnamespace is used, see Namespaces for more details)
- The language template used for new functions. Currently,
rustare available (default
assemblyscript), with more coming in future versions of Compute.
fn in question does not exist, the editor will automatically create a new function.
Building and deploying
Once the customer has edited their function, the
build button in the top right will allow them to check to ensure the function builds. The builder service will build the function and then return the results to the console area.
Assuming the build succeeds, the customer can choose to deploy the latest version with the
deploy button. If they choose not to deploy, the draft will be available to them later.
Until the customer deploys the function, it will remain at the previous version. The API Reference gives you details about the draft and active versions of any function.