Skip to content

Commit

Permalink
Merge pull request #90 from skant7/main
Browse files Browse the repository at this point in the history
fix: pull specific postgres version image
  • Loading branch information
skant7 authored Jan 30, 2022
2 parents de66124 + 569c2ea commit cdcaf7b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
23 changes: 13 additions & 10 deletions api/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ type service struct {
//Port uint
Db dbCluster
DockerNetwork string

Version version
BackupEnabled bool
Backup backupConfig
}

type version struct {
Maj uint
Min uint
}
type dbCluster struct {
Name string
ID string
Type string
Port int
Username string
Password string
MajVersion uint
MinVersion uint
Name string
ID string
Type string
Port int
Username string
Password string

Memory string
Storage string
Monitoring string
Expand Down Expand Up @@ -97,6 +99,7 @@ func CreateService(w http.ResponseWriter, req *http.Request) {
}

err = json.Unmarshal(byteArray, &s)
log.Printf("%d %d", s.Version.Maj, s.Version.Min)
if s.UserID == "" && apiKeyHeader != "" {
s.UserID = "testuser"
}
Expand Down
4 changes: 4 additions & 0 deletions api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ func CreateDockerComposeFile(absolutepath string, s service) error {
Architecture string
Type string
Port int
MajVersion uint
MinVersion uint
PostgresUsername string
PostgresPassword string
}{
s.UserID,
s.Architecture,
s.Db.Type,
s.Db.Port,
s.Version.Maj,
s.Version.Min,
s.Db.Username,
s.Db.Password,
}
Expand Down
2 changes: 1 addition & 1 deletion templates/templates/docker-compose-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: "3.9"
services:
postgres:
image: {{ .Architecture }}/{{ .Type }}
image: {{ .Architecture }}/{{ .Type }}:{{.MajVersion}}.{{.MinVersion}}
restart: unless-stopped
ports:
- "{{ .Port }}:5432"
Expand Down

0 comments on commit cdcaf7b

Please sign in to comment.