import type { AzionConfig } from '@aziontech/config'; const config: AzionConfig = { build: { bundler: 'esbuild', polyfills: true, }, storage: [ { name: '$BUCKET_NAME', dir: '.edge/next-build-assets', workloadsAccess: 'read_only', prefix: '$BUCKET_PREFIX', }, ], connectors: [ { name: '$CONNECTOR_NAME', active: true, type: 'storage', attributes: { bucket: '$BUCKET_NAME', prefix: '$BUCKET_PREFIX', }, }, ], functions: [ { name: '$FUNCTION_NAME', path: './functions/handler.js', bindings: { storage: { bucket: '$BUCKET_NAME', prefix: '$BUCKET_PREFIX', }, }, }, ], applications: [ { name: '$APPLICATION_NAME', cache: [ { name: '$APPLICATION_NAME', browser: { maxAgeSeconds: 7200, }, edge: { maxAgeSeconds: 7200, }, }, ], rules: { request: [ { name: 'Next.js Static Assets and set cache policy', description: 'Serve Next.js static assets through edge connector and set cache policy', active: true, criteria: [ [ { variable: '${uri}', conditional: 'if', operator: 'matches', argument: '^/_next/static/', }, ], ], behaviors: [ { type: 'set_connector', attributes: { value: '$CONNECTOR_NAME', }, }, { type: 'set_cache_policy', attributes: { value: '$APPLICATION_NAME', }, }, { type: 'deliver', }, ], }, { name: 'Deliver Static Assets and set cache policy', description: 'Serve static assets through edge connector and set cache policy', active: true, criteria: [ [ { variable: '${uri}', conditional: 'if', operator: 'matches', argument: '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', }, ], ], behaviors: [ { type: 'set_connector', attributes: { value: '$CONNECTOR_NAME', }, }, { type: 'set_cache_policy', attributes: { value: '$APPLICATION_NAME', }, }, { type: 'deliver', }, ], }, { name: 'Execute Next.js Function', description: 'Execute Next.js edge function for all requests', active: true, criteria: [ [ { variable: '${uri}', conditional: 'if', operator: 'matches', argument: '^/', }, ], ], behaviors: [ { type: 'run_function', attributes: { value: '$FUNCTION_NAME', }, }, { type: 'forward_cookies', }, ], }, ], }, functionsInstances: [ { name: '$FUNCTION_INSTANCE_NAME', ref: '$FUNCTION_NAME', }, ], }, ], workloads: [ { name: '$WORKLOAD_NAME', active: true, infrastructure: 1, deployments: [ { name: '$DEPLOYMENT_NAME', current: true, active: true, strategy: { type: 'default', attributes: { application: '$APPLICATION_NAME', }, }, }, ], }, ], }; export default config;