Skip to content

Commit

Permalink
Fall back to simplified relationships.
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwcarlson committed Jun 13, 2024
1 parent f1c5e52 commit dc5e2b7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
5 changes: 3 additions & 2 deletions internal/question/models/answer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package models

import (
"encoding/json"
"fmt"
// "fmt"

Check failure on line 5 in internal/question/models/answer.go

View workflow job for this annotation

GitHub Actions / test

commentedOutImport: remove commented-out "fmt" import (gocritic)
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -169,7 +169,8 @@ func getRelationships(services []Service) map[string]string {
if remappedEndpoint, ok := endpointRemap[endpoint]; ok {

Check failure on line 169 in internal/question/models/answer.go

View workflow job for this annotation

GitHub Actions / test

SA4006: this value of `remappedEndpoint` is never used (staticcheck)
endpoint = remappedEndpoint

Check failure on line 170 in internal/question/models/answer.go

View workflow job for this annotation

GitHub Actions / test

ineffectual assignment to endpoint (ineffassign)
}
relationships[service.Name] = fmt.Sprintf("%s:%s", service.Name, endpoint)
// relationships[service.Name] = fmt.Sprintf("%s:%s", service.Name, endpoint)

Check failure on line 172 in internal/question/models/answer.go

View workflow job for this annotation

GitHub Actions / test

commentedOutCode: may want to remove commented-out code (gocritic)
relationships[service.Name] = ""
}
return relationships
}
10 changes: 5 additions & 5 deletions internal/question/models/answer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Test_getRelationships(t *testing.T) {
},
},
want: map[string]string{
"mysql": "mysql:mysql",
"mysql": "",
},
},
{
Expand Down Expand Up @@ -66,10 +66,10 @@ func Test_getRelationships(t *testing.T) {
},
},
want: map[string]string{
"mariadb": "mariadb:mysql",
"oracle-mysql": "oracle-mysql:mysql",
"chrome-headless": "chrome-headless:http",
"redis-persistent": "redis-persistent:redis",
"mariadb": "",
"oracle-mysql": "",
"chrome-headless": "",
"redis-persistent": "",
},
},
}
Expand Down
6 changes: 3 additions & 3 deletions platformifier/platformifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ var (
},
},
Relationships: map[string]string{
"db": "db:postgresql",
"mysql": "mysql:mysql",
"db": "",
"mysql": "",
},
HasGit: true,
Services: []Service{
Expand Down Expand Up @@ -125,7 +125,7 @@ var (
},
},
Relationships: map[string]string{
"mysql": "mysql:mysql",
"mysql": "",
},
HasGit: true,
Services: []Service{
Expand Down
2 changes: 1 addition & 1 deletion platformifier/templates/generic/.platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type: "{{ .Type }}"
{{ if .Relationships -}}
relationships:
{{ range $key, $value := .Relationships }}
{{- $key }}: "{{ $value }}"
{{- $key }}:
{{ end -}}
{{ else }}
# relationships:
Expand Down
6 changes: 1 addition & 5 deletions platformifier/templates/upsun/.upsun/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ applications:
relationships:
{{ range $key, $value := .Relationships }}
{{- $key }}:
service: "{{ $key }}"
endpoint: "{{ $value }}"
{{ end -}}
{{ else }}
# relationships:
# database:
# service: db
# endpoint: postgresql
# database: "db:postgresql"
{{ end }}

# Mounts define directories that are writable after the build is complete.
Expand Down

0 comments on commit dc5e2b7

Please sign in to comment.