Functions are blocks of code that run on demand without the need to manage any infrastructure. Develop on your local machine, test your code from the command line (using doctl
), then deploy to a production namespace or App Platform — no servers required.
If you have deployed a function through the DigitalOcean Control Panel, you can configure it using its Settings tab.
Functions that have been deployed from the command line using doctl
should be configured through their project.yml
file instead. Any settings changed in the control panel could be overwritten by future command line deploys.
See the Project Configuration YAML File reference for more information on configuring settings using project.yml
.
To get to a function’s Settings tab, first navigate to the function in the control panel: find the function that you’d like to update in the function list, then click its name to go to the function’s Source tab. Then, click the Settings tab:
From this tab you can configure the function’s runtime, resource limits, environmental variables, and its access and security settings. You can also destroy the function to permanently delete it.
A function’s runtime is the programming language environment that runs your code. To change the runtime, click the Edit text beside the runtime setting. Choose a new runtime from the dropdown menu, then press Save to save the selection.
The Limits section allows for editing the function’s timeout and memory limits. Click the Edit text to change these settings:
The Environment Variables section shows how many environment variables are currently set. Click the Edit text to edit the variables.
The editing interface shows the current variables, a button for the Raw Editor, and a form where you can add key/value pairs one at a time.
To add an environment variable, fill out the Add Environment Variable form, then press Add. This screenshot shows the user adding an example_key=demo
variable:
After pressing Add the variable is added to the list of variables:
From here, you must press Save to save the changes to your variables and exit out of the editing interface.
An alternate way of adding and editing environment variables is to use the raw editor. This can be useful for copying and pasting multiple variables at once. Click the Raw Editor button to open the editor:
You may add key=value
pairs following standard .env
file rules. Hit Save and the variables will be parsed and the list of variables will be updated. Press Save again to save the new set of variables and exit the editing interface.
This section allows you to control settings related to Web Functions and function authentication. It also shows example curl
commands for invoking the current function.
Web Functions are functions that are accessible through normal HTTP methods such as GET
, POST
, PUT
, PATCH
, DELETE
, HEAD
, and OPTIONS
. These functions are expected to be synchronous, meaning they accept requests, do their work, and return a response as soon as possible (within the configured timeout).
Click the Edit text to configure the Web Functions Settings:
There are three checkboxes to configure:
x-require-whisk-auth
header for each request.To permanently destroy your function, click Destroy. A confirmation form pops up. Enter the function name into the field and then press Destroy again to confirm.
You can read more about the Destroy feature in How to Destroy Functions