Skip to content
GigadriveDocs

Configuration reference

Every key gigadrive.yaml accepts, with its type, its default, and what the platform does with it.

The keys the v4 schema accepts, grouped by the block they belong to. Defaults are what you get when the key is absent, not what a generated file would contain. The keys are the same whether you write YAML, JSON or the executable form TypeScript configuration covers.

Top level

KeyTypeDefaultWhat it does
versioninteger, 4 onlynone, requiredDeclares the config format. Must be a number, and 4 is the only accepted value
assetsstringnoneOne directory whose files are published to the edge. See Assets
functionsmap of pattern to settings{}Turns matching files into Functions. See Entrypoints
routeslist, 1024 at most[]Maps request paths onto those Functions. See Routes
imagesobjectnoneThe image optimization policy. See Images
servicesobjectnoneInfrastructure the deployment provisions for itself
envmap of string to string{}Accepted and not applied. See Environment variables
build_commandslist of strings[]Accepted and not run. See Build commands
populateAssetCachebooleanfalseAccepted and not read
presetslist of stringsnoneAccepted and not read

env is validated at 100 keys at most, each value a string of 65536 characters at most, and then goes unused: no part of the build or the provisioning pipeline applies it, so a name written there appears in neither a build nor a running Function. Set variables with the console, the CLI or the API instead. Unknown keys at this level pass validation and are discarded too.

functions.<pattern>

The key is a glob, or a regular expression anchored at both ends when it is not the name of an existing file. Every file it matches becomes one Function.

KeyTypeDefaultWhat it does
runtimenode-22, node-20, node-18, node-16, bun-1, php-84, php-83, php-81node-20The language and major version the Function runs under
memorynumber, MB, 128 to 3009128RAM for the Function. See Memory and CPU
max_durationnumber, seconds, 1 to 2880030Ceiling on one invocation, including its response stream or WebSocket connection
schedulestringnoneRuns the Function on a timer. See Cron jobs
symlinksmap, 1 to 100 entries, each side 256 characters at mostnoneLinks created in the project before packaging. Both ends must resolve inside the project root
includeFilesstring or list of stringsnoneGlobs added to the package after dependency tracing
excludeFilesstring or list of stringsnoneGlobs removed from the package, and from the pattern match itself

runtime, memory, max_duration, includeFiles, and excludeFiles merge across every pattern that matches a file, with later patterns winning. symlinks and schedule are read only from the pattern that first produced the file.

routes[]

KeyTypeDefaultWhat it does
sourcestring, 4096 at mostrequiredLiteral path, prefix ending in *, or regular expression matched against the request path
destinationstring, 4096 at mostrequiredThe entrypoint path this route serves, exactly as written in functions, with no leading slash
methodslist of ANY, GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS[ANY]Which methods the route answers. Each one becomes its own entry in the route table
headersmap of string to string{}Response headers set after the handler returns
statusCodeinteger, 100 to 999noneAccepted and not applied
redirectbooleannoneAccepted. The route is never created, so the path answers 404
haslist, 16 at mostnoneAccepted and not applied
missinglist, 16 at mostnoneAccepted and not applied

An entry in has or missing is { type: host, value }, or { type: header | cookie | query, key, value } where value is optional. Both are validated strictly and then ignored.

images

Supplying the block fills in every key you leave out. Omitting it emits no policy.

KeyTypeDefault
widths1 to 64 integers, each 1 to 8192[640, 750, 828, 1080, 1200, 1920, 2048, 3840]
heightsup to 64 integers, each 1 to 8192[]
qualities1 to 100 integers, each 1 to 100[75]
formats1 to 4 of image/avif, image/webp, image/jpeg, image/png[image/avif, image/webp]
localPatternsup to 64 objects[{ pathname: /** }]
remotePatternsup to 64 objects[]
minimumCacheTTLinteger, 0 to 31536000 seconds14400
dangerouslyAllowSVGbooleanfalse
contentSecurityPolicystring, 4096 at mostdefault-src 'self'; script-src 'none'; sandbox;
contentDispositionTypeinline or attachmentattachment
maximumRedirectsinteger, 0 to 103
maximumResponseBodyinteger, 1024 to 104857600 bytes52428800
variantsup to 100 named entries{}

A localPatterns entry takes pathname (1 to 2048 characters) and search. A remotePatterns entry requires hostname (1 to 253 characters) and takes protocol (http or https), port, pathname, and search. A variant name matches ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$ and sets at least one of width (1 to 8192), height (1 to 8192), quality (1 to 100), format, and fit (contain, cover, fill, inside, outside).

services.storage

services:
  storage:
    buckets:
      user-uploads: null
      brand-assets:
        visibility: public

buckets is required when storage is present. A bucket name is 3 to 63 characters of lowercase letters, digits, and hyphens, starting and ending alphanumeric, and it may not look like a UUID. The value is null, {}, or { visibility: public | private }, and visibility defaults to private.

Provisioning is additive and scoped to the deployment's environment. A repeated deployment reuses an existing bucket without changing its visibility, and a bucket you stop declaring is never deleted. Declaring buckets on a deployment that has no environment fails the build. Buckets covers what you then do with them.

When the file is rejected

ConditionResult
The file is empty, or the YAML or JSON does not parseThe build fails, naming the file
A TypeScript or JavaScript config throws, or exports no objectThe build fails, naming the file. See TypeScript configuration
version is missing or is not a numberThe build fails before schema validation, naming the file
version is a number other than 4The build fails with an unsupported-version error
A value breaks the schemaThe build fails and lists each violation with the path to it
Scanning the project for a functions pattern failsThe build fails, naming the pattern. A pattern that matches nothing is not a failure
A declared entrypoint file does not exist on a Node or Bun runtimeThe build fails before packaging, naming the file and the config it came from

One more check runs outside the build. gigadrive deploy reads the parser's error list before uploading and refuses a project that resolves to no Functions, no assets and no routes: The current project config does not resolve to any functions, assets or routes and can not be deployed. An archive uploaded without that check is unpacked and read the same way, and the deployment fails with the same message before any build starts. The build itself never reads that list.