Skip to content

Commit

Permalink
feat: Add env_vars to storage configuration and update JSON schema
Browse files Browse the repository at this point in the history
  • Loading branch information
yarlson committed Oct 20, 2024
1 parent c694569 commit 4f04d8d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 24 deletions.
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
87 changes: 64 additions & 23 deletions schemas/ftl-schema.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}

0 comments on commit 4f04d8d

Please sign in to comment.