[build]
publish = "docs/build"
command = "make netlify-latest"
edge_functions = "docs/functions"

[build.environment]
# Keep in sync with docs/.nvmrc — that file is the source of truth for the
# Node version, but Netlify only auto-detects .nvmrc at the repo root.
NODE_VERSION = "24"
# some examples in v1/test/cases/testdata/v0/cryptox509* flag the netlify
# secret scan
SECRETS_SCAN_OMIT_PATHS = "v1/test/cases,v1/topdown/crypto_test.go"

[context.deploy-preview]
command = "make netlify-edge"
ignore = "git diff --quiet HEAD~1 -- docs/ netlify.toml"

[[edge_functions]]
# this path should not be changed as various external sites depend on it for OPA
# badges.
path = "/badge/*"
function = "badge"

# Redirect all path based versioned requests to their new archived sites.
# https://github.com/open-policy-agent/opa/issues/7037
[[edge_functions]]
path = "/docs/*"
function = "version-redirect"

# Canonicalize legacy .html URLs onto their clean-path equivalents.
[[edge_functions]]
path = "/*"
function = "clean-html-urls"

# function to process form notifications from netlify forms and send them to slack
[[edge_functions]]
path = "/api/feedback"
function = "feedback"

# /data/versions.json is used by versioned OPA deployments to determine
# if what the latest release is, how outdated they are.
[[headers]]
for = "/data/versions.json"
[headers.values]
Access-Control-Allow-Origin = "*"
Access-Control-Allow-Methods = "GET, OPTIONS"
Access-Control-Allow-Headers = "Content-Type"
