Skip to content

Commit

Permalink
refactor: Update Storage struct to use EnvVar type for env_vars
Browse files Browse the repository at this point in the history
  • Loading branch information
yarlson committed Oct 20, 2024
1 parent 4f04d8d commit 51f766d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type Storage struct {
Name string `yaml:"name" validate:"required"`
Image string `yaml:"image" validate:"required"`
Volumes []string `yaml:"volumes" validate:"dive,volume_reference"`
EnvVars []string `yaml:"env_vars" validate:"dive"`
EnvVars []EnvVar `yaml:"env_vars" validate:"dive"`
}

type Volume struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func (d *Deployment) startStorage(storage *config.Storage, network string) error
Name: storage.Name,
Image: storage.Image,
Volumes: storage.Volumes,
EnvVars: storage.EnvVars,
}
if err := d.startContainer(service, network, ""); err != nil {
return fmt.Errorf("failed to start container for %s: %v", storage.Image, err)
Expand Down
14 changes: 12 additions & 2 deletions schemas/ftl-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"type": "array",
"items": {
"type": "object",
"required": ["name", "image"],
"required": ["name", "image", "volumes"],
"properties": {
"name": { "type": "string" },
"image": { "type": "string" },
Expand All @@ -110,7 +110,17 @@
},
"env_vars": {
"type": "array",
"items": { "type": "string" }
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
}
Expand Down

0 comments on commit 51f766d

Please sign in to comment.