Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This module provides comprehensive configuration and validation for the Azion Pl
- [`AzionFirewall`](#azionfirewall)
- [`AzionWaf`](#azionwaf)
- [`AzionCustomPages`](#azioncustompages)
- [`AzionKV`](#azionkv)

## Installation

Expand Down Expand Up @@ -359,6 +360,11 @@ const config = defineConfig({
layer: 'cache',
},
],
kv: [
{
name: 'my-kv',
},
],
});
```

Expand Down Expand Up @@ -898,3 +904,11 @@ Type definition for individual custom pages.
- `ttl?: number` - Time to live (0-31536000 seconds, default: 0).
- `uri?: string | null` - URI path (must start with /, max 250 characters).
- `customStatusCode?: number | null` - Custom status code (100-599).

### `AzionKV`

Type definition for the Key-Value (KV) storage configuration.

**Properties:**

- `name: string` - Name of the KV storage (1-255 characters).
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import type {
AzionConfig,
AzionConnector,
CacheByCookie,
CacheByQueryString,
ConnectorDnsResolution,
ConnectorHttpVersionPolicy,
ConnectorTransportPolicy,
ConnectorType,
CustomPageErrorCode,
CustomPageType,
NetworkListType,
WafSensitivity,
WafThreatType,
WorkloadInfrastructure,
WorkloadMTLSVerification,
WorkloadTLSCipher,
WorkloadTLSVersion,
AzionConfig,
AzionConnector,
CacheByCookie,
CacheByQueryString,
ConnectorDnsResolution,
ConnectorHttpVersionPolicy,
ConnectorTransportPolicy,
ConnectorType,
CustomPageErrorCode,
CustomPageType,
NetworkListType,
WafSensitivity,
WafThreatType,
WorkloadInfrastructure,
WorkloadMTLSVerification,
WorkloadTLSCipher,
WorkloadTLSVersion,
} from 'azion/config';

const config: AzionConfig = {
Expand Down Expand Up @@ -612,6 +612,11 @@ const config: AzionConfig = {
],
},
],
kv: [
{
name: 'my-kv',
},
],
};

export default config;
26 changes: 25 additions & 1 deletion packages/config/src/configProcessor/helpers/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,25 @@ const schemaStorage = {
},
};

const schemaKV = {
type: 'object',
properties: {
name: {
type: 'string',
minLength: 6,
maxLength: 63,
pattern: '^.{6,63}$',
errorMessage: "The 'name' field must be a string between 6 and 63 characters.",
},
},
required: ['name'],
additionalProperties: false,
errorMessage: {
additionalProperties: 'No additional properties are allowed in kv items.',
required: "The 'name' field is required.",
},
};

const azionConfigSchema = {
$id: 'azionConfig',
definitions: {
Expand Down Expand Up @@ -1924,7 +1943,12 @@ const azionConfigSchema = {
storage: {
type: 'array',
items: schemaStorage,
errorMessage: "The 'storage' field must be an array of storage items.",
errorMessage: "The 'storage' field must be an array of storage items.",
},
kv: {
type: 'array',
items: schemaKV,
errorMessage: "The 'kv' field must be an array of kv items.",
},
},
additionalProperties: false,
Expand Down
110 changes: 67 additions & 43 deletions packages/config/src/configProcessor/helpers/schemaManifest.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
import {
APPLICATION_DELIVERY_PROTOCOLS,
APPLICATION_HTTP_PORTS,
APPLICATION_HTTPS_PORTS,
APPLICATION_SUPPORTED_CIPHERS,
APPLICATION_TLS_VERSIONS,
CACHE_ADAPTIVE_DELIVERY,
CACHE_BROWSER_SETTINGS,
CACHE_BY_COOKIE,
CACHE_BY_QUERY_STRING,
CACHE_CDN_SETTINGS,
CACHE_VARY_BY_METHOD,
COOKIE_BEHAVIORS,
CUSTOM_PAGE_ERROR_CODES,
EDGE_CONNECTOR_DNS_RESOLUTION,
EDGE_CONNECTOR_HMAC_TYPE,
EDGE_CONNECTOR_HTTP_VERSION_POLICY,
EDGE_CONNECTOR_LOAD_BALANCE_METHOD,
EDGE_CONNECTOR_TRANSPORT_POLICY,
EDGE_CONNECTOR_TYPES,
FIREWALL_BEHAVIOR_NAMES,
FIREWALL_RATE_LIMIT_BY,
FIREWALL_RATE_LIMIT_TYPES,
FIREWALL_RULE_CONDITIONALS,
FIREWALL_RULE_OPERATORS,
FIREWALL_VARIABLES,
FIREWALL_WAF_MODES,
HEADER_BEHAVIORS,
ID_BEHAVIORS,
NETWORK_LIST_TYPES,
NO_ARGS_BEHAVIORS,
RULE_CONDITIONALS,
RULE_OPERATORS_WITH_VALUE,
RULE_OPERATORS_WITHOUT_VALUE,
RULE_VARIABLES,
STRING_BEHAVIORS,
TIERED_CACHE_TOPOLOGY,
WAF_ENGINE_VERSIONS,
WORKLOAD_HTTP_VERSIONS,
WORKLOAD_MTLS_VERIFICATION,
WORKLOAD_TLS_VERSIONS,
APPLICATION_DELIVERY_PROTOCOLS,
APPLICATION_HTTP_PORTS,
APPLICATION_HTTPS_PORTS,
APPLICATION_SUPPORTED_CIPHERS,
APPLICATION_TLS_VERSIONS,
CACHE_ADAPTIVE_DELIVERY,
CACHE_BROWSER_SETTINGS,
CACHE_BY_COOKIE,
CACHE_BY_QUERY_STRING,
CACHE_CDN_SETTINGS,
CACHE_VARY_BY_METHOD,
COOKIE_BEHAVIORS,
CUSTOM_PAGE_ERROR_CODES,
EDGE_CONNECTOR_DNS_RESOLUTION,
EDGE_CONNECTOR_HMAC_TYPE,
EDGE_CONNECTOR_HTTP_VERSION_POLICY,
EDGE_CONNECTOR_LOAD_BALANCE_METHOD,
EDGE_CONNECTOR_TRANSPORT_POLICY,
EDGE_CONNECTOR_TYPES,
FIREWALL_BEHAVIOR_NAMES,
FIREWALL_RATE_LIMIT_BY,
FIREWALL_RATE_LIMIT_TYPES,
FIREWALL_RULE_CONDITIONALS,
FIREWALL_RULE_OPERATORS,
FIREWALL_VARIABLES,
FIREWALL_WAF_MODES,
HEADER_BEHAVIORS,
ID_BEHAVIORS,
NETWORK_LIST_TYPES,
NO_ARGS_BEHAVIORS,
RULE_CONDITIONALS,
RULE_OPERATORS_WITH_VALUE,
RULE_OPERATORS_WITHOUT_VALUE,
RULE_VARIABLES,
STRING_BEHAVIORS,
TIERED_CACHE_TOPOLOGY,
WAF_ENGINE_VERSIONS,
WORKLOAD_HTTP_VERSIONS,
WORKLOAD_MTLS_VERIFICATION,
WORKLOAD_TLS_VERSIONS,
} from '../../constants';

const schemaNetworkListManifest = {
Expand Down Expand Up @@ -257,6 +257,25 @@ const schemaStorageManifest = {
},
};

const schemaKvManifest = {
type: 'object',
properties: {
name: {
type: 'string',
minLength: 6,
maxLength: 63,
pattern: '^.{6,63}$',
errorMessage: "The 'name' field must be a string between 6 and 63 characters.",
},
},
required: ['name'],
additionalProperties: false,
errorMessage: {
additionalProperties: 'No additional properties are allowed in kv items.',
required: "The 'name' field is required.",
},
};

const schemaFirewallRuleBehaviorArguments = {
set_rate_limit: {
type: 'object',
Expand Down Expand Up @@ -642,13 +661,13 @@ const schemaApplicationCacheSettings = {
},
required: ['enabled'],
if: {
properties: { enabled: { const: true } }
properties: { enabled: { const: true } },
},
then: {
required: ['enabled', 'topology'],
errorMessage: {
required: "When 'enabled' is true, 'topology' is required in the 'tiered_cache' object."
}
required: "When 'enabled' is true, 'topology' is required in the 'tiered_cache' object.",
},
},
additionalProperties: false,
},
Expand Down Expand Up @@ -1945,6 +1964,11 @@ const schemaManifest = {
items: schemaStorageManifest,
errorMessage: "The 'storage' field must be an array of storage items.",
},
kv: {
type: 'array',
items: schemaKvManifest,
errorMessage: "The 'kv' field must be an array of kv items.",
},
},
required: ['build', 'applications', 'workloads', 'workload_deployments'],
errorMessage: {
Expand Down
Loading