Skip to content

Commit

Permalink
feat: delete urls from template v3
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin Guidée <[email protected]>
  • Loading branch information
quentinguidee committed Mar 5, 2024
1 parent 068593b commit a90b4cf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion client/src/apps/Containers/backend/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ export type Template = {
features: Features;
environment: EnvVariable[];
databases: { [name: string]: DatabaseEnvironment };
urls?: URL[];
methods?: ServiceMethods;
};
10 changes: 2 additions & 8 deletions docs/docs/vertex/next/05-extensions/01-custom-service.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ To upgrade from `v2` to `v3`, you need to:
1. Change the `version` field to `3`
2. Remove all `environment` of type `port`
3. Remove all `methods.docker.ports`
4. Create a new `ports` field with the port name and the port number
4. Remove all `urls`
5. Create a new `ports` field with the port name and the port number
:::

```yaml title="service.yml"
Expand Down Expand Up @@ -75,13 +76,6 @@ ports:
- name: PORT_NAME
port: 8080

# The urls that this service exposes.
urls:
- name: Redis
port: PORT_NAME
ping: /
kind: server

# The methods to run the service.
methods:
# Describe how to run it with a Docker image.
Expand Down
3 changes: 3 additions & 0 deletions server/apps/containers/core/types/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type Template struct {
Ports []TemplatePort `yaml:"ports,omitempty" json:"ports,omitempty"`

// URLs defines all template urls.
// Deprecated: URLs are deleted in version 3.
URLs []URL `yaml:"urls,omitempty" json:"urls,omitempty"`

// Methods define different methods to install the template.
Expand Down Expand Up @@ -106,6 +107,7 @@ func (s *TemplateV2) Upgrade() *TemplateV3 {
}
}
s.Env = envs
s.URLs = []URL{}
return (*TemplateV3)(s)
}

Expand Down Expand Up @@ -289,6 +291,7 @@ type TemplateMethods struct {
Docker *TemplateMethodDocker `yaml:"docker,omitempty" json:"docker,omitempty"`
}

// Deprecated: Deleted in version 3.
type URL struct {
// Name is the name displayed to the used describing this URL.
Name string `yaml:"name" json:"name" example:"Vertex Client"`
Expand Down
1 change: 1 addition & 0 deletions server/apps/containers/core/types/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@ func (suite *TemplateTestSuite) TestTemplateUpgradeV3() {
},
}, template.Ports)
suite.Empty(template.Env)
suite.Empty(template.URLs)
}

0 comments on commit a90b4cf

Please sign in to comment.