Azion IaC
O arquivo azion.config.js
é um arquivo de configuração de IaC criado durante o processo de build da aplicação, com base no preset selecionado, e serve como a fonte de verdade para a configuração. Cada preset fornece um conjunto de configurações padrão, que podem ser substituídas pelo usuário. Se o arquivo for excluído, a configuração padrão será recriada na próxima vez que o processo de build for disparado.
As configurações definidas por este arquivo incluem:
- Build Configurations
- Origins
- Cache Settings
- Rules Engine
- Network List
- Purge Settings
As tabelas a seguir explicam as propriedades deste arquivo de configuração.
build
Propriedade | Tipo | Descrição | Valores esperados |
---|---|---|---|
builder | String | A ferramenta de build a ser usada | esbuild ou webpack |
preset | Object | O preset a ser usado | Propriedade: name (String) |
entry | String | Ponto de entrada para sua aplicação | |
polyfills | Boolean | Se deve incluir polyfills do Node.js | |
worker | Boolean | Se deve construir um worker proprietário | |
custom | Object | Configuração de build personalizada | |
memoryFS | Object | Configuração do sistema de arquivos em memória | Propriedades: InjectionDirs (Array) RemovePathPrefix (String) |
domain
Propriedade | Tipo | Valores esperados | Mensagem de erro |
---|---|---|---|
name | string | ||
cnameAccessOnly | boolean | ||
cnames | array | ||
edgeApplicationId | number | ||
edgeFirewallId | number | ||
digitalCertificateId | string, null | lets_encrypt or null | |
mtls | object | ||
mtls -> verification | string | enforce or permissive | |
mtls -> trustedCaCertificateId | number | ||
mtls -> crlList | array |
origin
Propriedade | Tipo | Valores esperados | Mensagem de erro |
---|---|---|---|
name | string | The ‘name’ field must be a string | |
type | string | single_origin (default)load_balancer live_ingest** object_storage | The ‘type’ field must be a string |
bucket | string, null | The ‘bucket’ field must be a string or null | |
prefix | string, null | The ‘prefix’ field must be a string or null | |
addresses | array | The ‘address’ field must be a string | |
hostHeader | string | The ‘hostHeader’ field must be a string | |
additionalProperties | boolean | No additional properties are allowed in origin item objects | |
protocolPolicy | string | preserve (default)https http | The ‘protocolPolicy’ field must be a string |
hostHeader | string | The ‘hostHeader’ field must be a string | |
connectionTimeout | number | The ‘connectionTimeout’ field must be a number | |
timeoutBetweenBytes | number | The ‘timeoutBetweenBytes’ field must be a number | |
redirection | boolean | The ‘redirection’ field must be a boolean | |
hmac | object | The ‘hmac’ field must be an object | |
hmac -> region | string | The ‘region’ field must be a string | |
hmac -> accessKey | string | The ‘accessKey’ field must be a string | |
hmac -> secretKey | string | The ‘secretKey’ field must be a string | |
bucket | string, null | The ‘bucket’ field must be a string or null | |
prefix | string, null | The ‘prefix’ field must be a string or null | |
additionalProperties | boolean | No additional properties are allowed in origin item objects |
cache
Propriedade | Tipo | Valores esperados | Mensagem de erro |
---|---|---|---|
name | string | The ‘name’ field must be a string | |
stale | boolean | The ‘stale’ field must be a boolean | |
queryStringSort | boolean | The ‘queryStringSort’ field must be a boolean | |
methods -> post | boolean | The ‘post’ field must be a boolean | |
methods -> options | boolean | The ‘options’ field must be a boolean | |
methods -> additionalProperties | boolean | No additional properties are allowed in the ‘methods’ object | |
browser -> maxAgeSeconds | number OR string (mathematical expression) | 0 ≤ value ≥ 31536000 | The ‘maxAgeSeconds’ field must be a number or a valid mathematical expression |
browser -> additionalProperties | boolean | No additional properties are allowed in the ‘browser’ object | |
browser -> required | array | The ‘maxAgeSeconds’ field is required in the ‘browser’ object | |
edge -> maxAgeSeconds | number OR string (a mathematical expression) | 60 ≤ value ≥ 31536000 | The ‘maxAgeSeconds’ field must be a number or a valid mathematical expression |
edge -> additionalProperties | boolean | No additional properties are allowed in the ‘edge’ object | |
edge -> required | array | The ‘maxAgeSeconds’ field is required in the ‘edge’ object |
rules
Request rules
Propriedade | Tipo | Mensagem de erro |
---|---|---|
name | string | The ‘name’ field must be a string |
match | string | The ‘match’ field must be a string |
setOrigin -> name | string | The ‘name’ field must be a string |
setOrigin -> type | string | The ‘type’ field must be a string |
setOrigin -> additionalProperties | boolean | No additional properties are allowed in the ‘setOrigin’ object |
setOrigin -> required | array | The ‘name or type’ field is required in the ‘setOrigin’ object |
behavior -> rewrite | function | The behavior of the rewrite |
setHeaders | string, null | The ‘setHeaders’ field must be a string or null |
forwardCookies | boolean, null | The ‘forwardCookies’ field must be a boolean or null |
setCookie | string, null | The ‘setCookie’ field must be a string or null |
deliver | boolean, null | The ‘deliver’ field must be a boolean or null |
runFunction -> path | string | The ‘path’ field must be a string |
runFunction -> name | string, null | The ‘name’ field can be a string or null |
runFunction -> additionalProperties | boolean | No additional properties are allowed in the ‘runFunction’ object |
runFunction -> required | array | The ‘path’ field is required in the ‘runFunction’ object |
cache | string OR object | The ‘cache’ field must be either a string or an object with specified properties |
cache -> name (when cache is an object) | string | The ‘name’ field must be a string |
cache -> browser_cache_settings_maximum_ttl (when cache is an object) | number, null | The ‘browser_cache_settings_maximum_ttl’ field must be a number or null |
cache -> cdn_cache_settings_maximum_ttl (when cache is an object) | number, null | The ‘cdn_cache_settings_maximum_ttl’ field must be a number or null |
cache -> additionalProperties (when cache is an object) | boolean | No additional properties are allowed in the cache object |
cache -> required (when cache is an object) | array | The ‘name’ field is required in the cache object |
redirectTo301 | string | The ‘redirectTo301’ field must be a string |
enableGZIP | boolean | The ‘enableGZIP’ field must be a boolean |
redirectTo302 | string | The ‘redirectTo302’ field must be a string |
filterCookie | string | The ‘filterCookie’ field must be a string |
variable | string | The ‘variable’ field must be a string |
bypassCache | boolean | The ‘bypassCache’ field must be a boolean |
redirectHttps | boolean | The ‘redirectHttps’ field must be a boolean |
Response rules
Property | Type | Error message |
---|---|---|
name | string | The ‘name’ field must be a string |
description | string | The ‘description’ field must be a string |
active | boolean | The ‘active’ field must be a boolean |
match | string | The ‘match’ field must be a string |
variable | string | The ‘variable’ field must be a string |
behavior -> setCookie | string, null | The ‘setCookie’ field must be a string or null |
behavior -> setHeaders | array of strings | Each item in ‘setHeaders’ must be a string |
behavior -> deliver | boolean, null | The ‘deliver’ field must be a boolean or null |
behavior -> capture -> match | string | The ‘match’ field must be a string |
behavior -> capture -> captured | string | The ‘captured’ field must be a string |
behavior -> capture -> subject | string | The ‘subject’ field must be a string |
behavior -> enableGZIP | boolean, null | The ‘enableGZIP’ field must be a boolean or null |
behavior -> filterCookie | string, null | The ‘filterCookie’ field must be a string or null |
behavior -> filterHeader | string, null | The ‘filterHeader’ field must be a string or null |
behavior -> runFunction -> path | string | The ‘path’ field must be a string |
behavior -> runFunction -> name | string, null | The ‘name’ field can be a string or null |
behavior -> redirectTo301 | string, null | The ‘redirectTo301’ field must be a string or null |
behavior -> redirectTo302 | string, null | The ‘redirectTo302’ field must be a string or null |
lista de redes
Propriedade | Tipo | Mensagem de erro |
---|---|---|
id | número | O campo ‘id’ deve ser um número |
listType | string | O campo ‘listType’ deve ser uma string |
listContent | array | O campo ‘listContent’ deve ser uma array de strings |
purge
Propriedade | tipo | Valores esperados | Mensagem de erro |
---|---|---|---|
type | string | url , cachekey , wildcard | |
urls | array | ||
method | string | delete | |
layer | string | edge_caching , l2_caching |
Para mais informações, acesse o esquema do azion.config.js no repositório Azion Lib.
Exemplo
Aqui está um exemplo de implementação do arquivo azion.config.js
: