diff --git a/schemas/common/db/full/v3.schema.json b/schemas/common/db/full/v3.schema.json new file mode 100644 index 00000000..0dcd19e7 --- /dev/null +++ b/schemas/common/db/full/v3.schema.json @@ -0,0 +1,34 @@ +{ + "$id": "https://mapcolonies.com/common/db/full/v3", + "description": "The full database schema including schema and database name", + "type": "object", + "allOf": [ + { + "$ref": "https://mapcolonies.com/common/db/partial/v2" + }, + { + "$ref": "#/definitions/db" + } + ], + "unevaluatedProperties": true, + "definitions": { + "db": { + "type": "object", + "required": ["database"], + "properties": { + "schema": { + "type": "string", + "description": "The schema name of the database", + "default": "public", + "x-env-value": "DB_SCHEMA" + }, + "database": { + "type": "string", + "description": "The database name", + "maxLength": 63, + "x-env-value": "DB_NAME" + } + } + } + } +} diff --git a/schemas/common/db/partial/v2.configs.json b/schemas/common/db/partial/v2.configs.json new file mode 100644 index 00000000..1e3f9e83 --- /dev/null +++ b/schemas/common/db/partial/v2.configs.json @@ -0,0 +1,10 @@ +[ + { + "name": "db-connection", + "value": { + "ssl": { + "enabled": false + } + } + } +] diff --git a/schemas/common/db/partial/v2.schema.json b/schemas/common/db/partial/v2.schema.json new file mode 100644 index 00000000..5b07e74e --- /dev/null +++ b/schemas/common/db/partial/v2.schema.json @@ -0,0 +1,83 @@ +{ + "$id": "https://mapcolonies.com/common/db/partial/v2", + "description": "database configuration for postgres", + "type": "object", + "required": ["ssl"], + "properties": { + "host": { + "type": "string", + "description": "the host of the database", + "default": "localhost", + "x-env-value": "DB_HOST" + }, + "port": { + "type": "integer", + "description": "the port of the database", + "default": 5432, + "x-env-value": "DB_PORT" + }, + "username": { + "type": "string", + "description": "the username of the database", + "default": "postgres", + "maxLength": 63, + "x-env-value": "DB_USERNAME" + }, + "password": { + "type": "string", + "description": "the password of the database", + "default": "postgres", + "x-env-value": "DB_PASSWORD" + }, + "ssl": { + "$ref": "#/definitions/ssl" + } + }, + "definitions": { + "ssl": { + "type": "object", + "description": "ssl configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "enable ssl", + "default": false, + "x-env-value": "DB_ENABLE_SSL_AUTH" + }, + "ca": { + "type": "string", + "description": "the path to the ca file", + "x-env-value": "DB_CA_PATH" + }, + "cert": { + "type": "string", + "description": "the path to the cert file", + "x-env-value": "DB_CERT_PATH" + }, + "key": { + "type": "string", + "description": "the path to the key file", + "x-env-value": "DB_KEY_PATH" + } + }, + "unevaluatedProperties": false, + "if": { + "properties": { + "enabled": { + "const": true + } + } + }, + "then": { + "required": ["cert", "key"] + }, + "else": { + "properties": { + "enabled": { + "const": false + } + } + } + } + } +}