Using credentials
Plugin form
If you need to use credentials or other secrets like an API-key to connect to your asset repository use the form
part
of registerVevComponent
:
registerVevPlugin({
form: [
{
type: "string",
name: "API_KEY",
title: "API Key",
},
],
...
});
The type of the form is described here
This form will show up when connecting the asset source and will deploy together with the serverless function, meaning it's not retrievable by anyone:
Retrieving the values in the handler
The values will then be available on the env
object in the handler function:
async function handler(
env: Record<string, string>,
...
): Promise<ProjectAsset[] | MetaFields> {
const apiKeyFromForm = env.API_KEY;
...