Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
skant7 committed Apr 10, 2022
1 parent 310b427 commit 760c3f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ curl -X POST http://localhost:4434/createservice \
"name": "localtest",
"username": "spinup",
"password": "spinup",
"memory": "6000", //In Megabytes
"cpu": "2"
"memory": 6000, //In Megabytes
"cpu": 2
},
"version": {"maj":9,"min":6}
}'
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ type dbCluster struct {
Username string
Password string

Memory string
CPU string `json:"cpu"`
Memory int64
CPU int64
Monitoring string
}

Expand Down
12 changes: 4 additions & 8 deletions internal/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type ContainerProps struct {
Username string
Password string
Port int
Memory string
CPUShares string
Memory int64
CPUShares int64
}

func NewPostgresContainer(props ContainerProps) (postgresContainer dockerservice.Container, err error) {
Expand Down Expand Up @@ -64,10 +64,6 @@ func NewPostgresContainer(props ContainerProps) (postgresContainer dockerservice
}
}()
containerName := PREFIXPGCONTAINER + props.Name

CPUShares, _ := strconv.Atoi(props.CPUShares)
Memory, _ := strconv.Atoi(props.Memory)

newHostPort, err := nat.NewPort("tcp", strconv.Itoa(props.Port))
if err != nil {
return dockerservice.Container{}, err
Expand Down Expand Up @@ -96,8 +92,8 @@ func NewPostgresContainer(props ContainerProps) (postgresContainer dockerservice
AutoRemove: false,
Mounts: mounts,
Resources: container.Resources{
CPUShares: int64(CPUShares),
Memory: int64(Memory * 1000000),
CPUShares: props.CPUShares,
Memory: props.Memory * 1000000,
},
}

Expand Down

0 comments on commit 760c3f4

Please sign in to comment.