diff --git a/pkg/config/config.go b/pkg/config/config.go index 486dc89..663fd1f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -67,7 +67,8 @@ type Route struct { type Storage struct { Name string `yaml:"name" validate:"required"` Image string `yaml:"image" validate:"required"` - Volumes []string `yaml:"volumes" validate:"required,dive,volume_reference"` + Volumes []string `yaml:"volumes" validate:"dive,volume_reference"` + EnvVars []string `yaml:"env_vars" validate:"dive"` } type Volume struct { diff --git a/schemas/ftl-schema.json b/schemas/ftl-schema.json index 17259fa..8177326 100644 --- a/schemas/ftl-schema.json +++ b/schemas/ftl-schema.json @@ -1,82 +1,123 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", + "required": ["project", "servers", "services"], "properties": { "project": { "type": "object", + "required": ["name", "domain", "email"], "properties": { "name": { "type": "string" }, - "domain": { "type": "string", "format": "hostname" }, - "email": { "type": "string", "format": "email" } - }, - "required": ["name", "domain", "email"] + "domain": { + "type": "string", + "format": "hostname" + }, + "email": { + "type": "string", + "format": "email" + } + } }, "servers": { "type": "array", "items": { "type": "object", + "required": ["host", "port", "user", "ssh_key"], "properties": { - "host": { "type": "string" }, - "port": { "type": "integer" }, + "host": { + "type": "string", + "format": "hostname-or-ip" + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, "user": { "type": "string" }, - "ssh_key": { "type": "string" } - }, - "required": ["host", "port", "user", "ssh_key"] + "ssh_key": { + "type": "string", + "format": "file-path" + } + } } }, "services": { "type": "array", "items": { "type": "object", + "required": ["name", "image", "port", "routes"], "properties": { "name": { "type": "string" }, - "path": { "type": "string" }, "image": { "type": "string" }, - "port": { "type": "integer" }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "path": { "type": "string" }, "health_check": { "type": "object", "properties": { "path": { "type": "string" }, - "interval": { "type": "string" }, - "timeout": { "type": "string" }, + "interval": { "type": "string", "format": "duration" }, + "timeout": { "type": "string", "format": "duration" }, "retries": { "type": "integer" } - }, - "required": ["path", "interval", "timeout", "retries"] + } }, "routes": { "type": "array", "items": { "type": "object", + "required": ["path"], "properties": { "path": { "type": "string" }, "strip_prefix": { "type": "boolean" } - }, - "required": ["path", "strip_prefix"] + } + } + }, + "volumes": { + "type": "array", + "items": { "type": "string" } + }, + "forwards": { + "type": "array", + "items": { "type": "string" } + }, + "env_vars": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "value": { "type": "string" } + } } } - }, - "required": ["name", "path", "image", "port", "health_check", "routes"] + } } }, "storages": { "type": "array", "items": { "type": "object", + "required": ["name", "image"], "properties": { "name": { "type": "string" }, "image": { "type": "string" }, "volumes": { "type": "array", "items": { "type": "string" } + }, + "env_vars": { + "type": "array", + "items": { "type": "string" } } - }, - "required": ["name", "image", "volumes"] + } } }, "volumes": { "type": "array", "items": { "type": "string" } } - }, - "required": ["project", "servers", "services", "storages", "volumes"] + } }