|
| 1 | +--- |
| 2 | +pagination_prev: null |
| 3 | +--- |
| 4 | + |
| 5 | +# Function editor |
| 6 | + |
| 7 | +The Compute code editor is available for you to embed in your application, so your users can build their functions quickly and easily: |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +The editor is hosted at `https://editor.suborbital.network`, and uses URL parameters to configure its connection to your builder service. |
| 12 | + |
| 13 | +You will host the Compute builder service in your cloud infrastructure with a configured DNS name. An HTTPS connection to the builder is required to use the editor. |
| 14 | + |
| 15 | +To launch the editor, you can either [embed the editor in a frame] |
| 16 | +(https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) within your own webpage, or launch it in a new tab. |
| 17 | + |
| 18 | +## Editor token |
| 19 | + |
| 20 | +To authenticate the editor for a specific user to edit their own functions,[Compute's Administrative API provides an API to create an `editor token` ] |
| 21 | +(https://suborbital-compute.readme.io/reference/gettoken) for a given function. |
| 22 | + |
| 23 | +## Configuration |
| 24 | + |
| 25 | +The editor is configured with URL parameters. Here's an example: |
| 26 | + |
| 27 | +`https://editor.suborbital.network?builder=https://builder.acmeco.com&token=K78as0aslwi30l8h5lbF4lS7&ident=com.suborbital.customer&fn=add-record` |
| 28 | + |
| 29 | +Let's break it down: |
| 30 | + |
| 31 | +**Builder**: `?builder=https://builder.acmeco.com` |
| 32 | + |
| 33 | +* This is the URL of your public builder service |
| 34 | + |
| 35 | +**Token**: `&token=K78as0aslwi30l8h5lbF4lS7` |
| 36 | + |
| 37 | +* The editor token retrieved from the control-plane service |
| 38 | + |
| 39 | +**Ident**: `&ident=com.suborbital.customer` |
| 40 | + |
| 41 | +* The identifier used when addressing your specific user, see [Fully-qualified function names](./fully-qualified-function-names.md) for more details |
| 42 | + |
| 43 | +**Fn**: `&fn=add-record` |
| 44 | + |
| 45 | +* The specific function name that the editor should load |
| 46 | + |
| 47 | +**Namespace** (optional): `&namespace=default` |
| 48 | + |
| 49 | +* The function namespace (if not included, the `default` namespace is used, see [Namespaces](docs/compute/customizing-functions/namespaces.md) for more details) |
| 50 | + |
| 51 | +**Template** (optional): `&template=assemblyscript` |
| 52 | + |
| 53 | +* The language template used for new functions. Check out our [supported languages](../../reactr/language-support.md)! |
| 54 | + |
| 55 | +If the `fn` in question does not exist, the editor will automatically create a new function. |
| 56 | + |
| 57 | +## Building and deploying |
| 58 | + |
| 59 | +Once the user 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. |
| 60 | + |
| 61 | +Assuming the build succeeds, the user 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. |
| 62 | + |
| 63 | +Until the user deploys the function, it will remain at the previous version. The [API Reference](https://suborbital-compute.readme.io/reference/api-reference) gives you details about the draft and active versions of any function. |
0 commit comments