-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add JSON schema for the configuration file (#23)
- Loading branch information
Showing
6 changed files
with
419 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,316 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$ref": "#/$defs/Config", | ||
"$defs": { | ||
"CacheConfig": { | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean", | ||
"description": "Whether in-memory caching is enabled.", | ||
"default": true | ||
}, | ||
"duration": { | ||
"type": "integer", | ||
"description": "Duration to keep in-memory cached content, in seconds." | ||
}, | ||
"maxSize": { | ||
"type": "integer", | ||
"description": "Maximum size of the in-memory cache." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"enabled" | ||
], | ||
"description": "CacheConfig specifies the cache duration and max size." | ||
}, | ||
"Config": { | ||
"properties": { | ||
"relay": { | ||
"$ref": "#/$defs/RelayConfig", | ||
"description": "RelayConfig for incoming connections." | ||
}, | ||
"uplink": { | ||
"$ref": "#/$defs/UplinkConfig", | ||
"description": "UplinkConfig for managing uplink configuration." | ||
}, | ||
"cache": { | ||
"$ref": "#/$defs/CacheConfig", | ||
"description": "CacheConfig for cache settings." | ||
}, | ||
"redis": { | ||
"$ref": "#/$defs/RedisConfig", | ||
"description": "RedisConfig for using redis as cache." | ||
}, | ||
"filesystem": { | ||
"$ref": "#/$defs/FilesystemCacheConfig", | ||
"description": "FilesystemCacheConfig for using filesystem as cache." | ||
}, | ||
"supergraphs": { | ||
"items": { | ||
"$ref": "#/$defs/SupergraphConfig" | ||
}, | ||
"type": "array", | ||
"description": "SupergraphConfig for supergraph settings." | ||
}, | ||
"webhook": { | ||
"$ref": "#/$defs/WebhookConfig", | ||
"description": "WebhookConfig for webhook handling." | ||
}, | ||
"polling": { | ||
"$ref": "#/$defs/PollingConfig", | ||
"description": "PollingConfig for polling settings." | ||
}, | ||
"managementAPI": { | ||
"$ref": "#/$defs/ManagementAPIConfig", | ||
"description": "ManagementAPIConfig for management API settings." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"relay", | ||
"uplink" | ||
], | ||
"description": "Config represents the application's configuration structure, housing Relay, Uplink, and Cache configurations." | ||
}, | ||
"FilesystemCacheConfig": { | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean", | ||
"description": "Whether Redis caching is enabled.", | ||
"default": false | ||
}, | ||
"directory": { | ||
"type": "string", | ||
"description": "Path to the filesystem cache." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"enabled", | ||
"directory" | ||
], | ||
"description": "FilesystemCacheConfig defines the configuration for connecting to a Redis cache." | ||
}, | ||
"ManagementAPIConfig": { | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean", | ||
"description": "Whether the management API is enabled.", | ||
"default": false | ||
}, | ||
"path": { | ||
"type": "string", | ||
"description": "Path to bind the management API handler on." | ||
}, | ||
"secret": { | ||
"type": "string", | ||
"description": "Secret for verifying management API requests." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"enabled" | ||
] | ||
}, | ||
"PollingConfig": { | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean", | ||
"description": "Whether polling is enabled.", | ||
"default": false | ||
}, | ||
"interval": { | ||
"type": "integer", | ||
"description": "Interval for polling, in seconds. Can only use either `interval` or `cronExpression`." | ||
}, | ||
"cronExpressions": { | ||
"items": { | ||
"type": "string" | ||
}, | ||
"type": "array", | ||
"description": "Cron expression to use for polling. Can only use either `interval` or `cronExpression`." | ||
}, | ||
"retryCount": { | ||
"type": "integer", | ||
"description": "Number of times to retry on polling failure." | ||
}, | ||
"entitlements": { | ||
"type": "boolean", | ||
"description": "Whether to poll for entitlements.", | ||
"default": true | ||
}, | ||
"supergraph": { | ||
"type": "boolean", | ||
"description": "Whether to poll for supergraph.", | ||
"default": true | ||
}, | ||
"persistedQueries": { | ||
"type": "boolean", | ||
"description": "Whether to poll for persisted queries.", | ||
"default": false | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"enabled" | ||
], | ||
"description": "PollingConfig defines the configuration for polling from uplink." | ||
}, | ||
"RedisConfig": { | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean", | ||
"description": "Whether Redis caching is enabled.", | ||
"default": false | ||
}, | ||
"address": { | ||
"type": "string", | ||
"description": "Address of the Redis server." | ||
}, | ||
"password": { | ||
"type": "string", | ||
"description": "Password for Redis authentication." | ||
}, | ||
"database": { | ||
"type": "integer", | ||
"description": "Database to use in the Redis server." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"enabled", | ||
"address" | ||
], | ||
"description": "RedisConfig defines the configuration for connecting to a Redis cache." | ||
}, | ||
"RelayConfig": { | ||
"properties": { | ||
"address": { | ||
"type": "string", | ||
"description": "Address to bind the relay server on.", | ||
"default": "localhost:8080", | ||
"examples": [ | ||
"0.0.0.0:8000" | ||
] | ||
}, | ||
"tls": { | ||
"$ref": "#/$defs/RelayTlsConfig", | ||
"description": "TLS configuration for the relay server." | ||
}, | ||
"publicURL": { | ||
"type": "string", | ||
"description": "Public URL for the relay server." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"description": "RelayConfig defines the address the proxy server listens on." | ||
}, | ||
"RelayTlsConfig": { | ||
"properties": { | ||
"cert": { | ||
"type": "string", | ||
"description": "Path to the certificate file." | ||
}, | ||
"key": { | ||
"type": "string", | ||
"description": "Path to the key file." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"cert", | ||
"key" | ||
], | ||
"description": "RelayTlsConfig defines the TLS configuration for the relay server." | ||
}, | ||
"SupergraphConfig": { | ||
"properties": { | ||
"graphRef": { | ||
"type": "string" | ||
}, | ||
"apolloKey": { | ||
"type": "string" | ||
}, | ||
"launchID": { | ||
"type": "string" | ||
}, | ||
"persistedQueryVersion": { | ||
"type": "string" | ||
}, | ||
"offlineLicense": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"graphRef", | ||
"apolloKey" | ||
], | ||
"description": "SupergraphConfig defines the list of graphs to use." | ||
}, | ||
"UplinkConfig": { | ||
"properties": { | ||
"urls": { | ||
"items": { | ||
"type": "string" | ||
}, | ||
"type": "array", | ||
"description": "List of URLs to use as uplink targets." | ||
}, | ||
"timeout": { | ||
"type": "integer", | ||
"description": "Timeout for uplink requests, in seconds." | ||
}, | ||
"retryCount": { | ||
"type": "integer", | ||
"description": "Number of times to retry on uplink failure." | ||
}, | ||
"studioAPIURL": { | ||
"type": "string", | ||
"description": "URL for the Studio API." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"urls" | ||
], | ||
"description": "UplinkConfig details the configuration for connecting to upstream servers." | ||
}, | ||
"WebhookConfig": { | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean", | ||
"description": "Whether webhook handling is enabled.", | ||
"default": false | ||
}, | ||
"path": { | ||
"type": "string", | ||
"description": "Path to bind the webhook handler on." | ||
}, | ||
"secret": { | ||
"type": "string", | ||
"description": "Secret for verifying webhook requests." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"required": [ | ||
"enabled", | ||
"path", | ||
"secret" | ||
], | ||
"description": "WebhookConfig defines the configuration for webhook handling." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# yaml-language-server: $schema=.vscode/configuration_schema.json | ||
relay: | ||
address: "localhost:8080" | ||
# tls: | ||
|
Oops, something went wrong.