File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ func WithVersion(version string) Option {
44
44
}
45
45
}
46
46
47
+ // WithImage sets image name
48
+ func WithImage (name string ) Option {
49
+ return func (o * P ) {
50
+ o .ImageName = name
51
+ }
52
+ }
53
+
47
54
// WithTimezone sets the timezone in this container.
48
55
func WithTimezone (timezone string ) Option {
49
56
return func (p * P ) {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const (
20
20
defaultSSLMode = "disable"
21
21
defaultPort = 5432
22
22
defaultVersion = "16.2"
23
+ defaultImage = "docker.io/library/postgres"
23
24
)
24
25
25
26
func init () {
@@ -51,11 +52,12 @@ type P struct {
51
52
Password string `json:"password"`
52
53
Timezone string `json:"timezone"`
53
54
Version string `json:"version"`
55
+ ImageName string `json:"image_name"`
54
56
}
55
57
56
58
// Image returns an image that should be pulled to create this container.
57
59
func (p * P ) Image () string {
58
- return fmt .Sprintf ("docker.io/library/postgres :%s" , p .Version )
60
+ return fmt .Sprintf ("%s :%s" , p . ImageName , p .Version )
59
61
}
60
62
61
63
// Ports returns ports that should be used to access this container.
@@ -151,6 +153,10 @@ func (p *P) setDefaults() {
151
153
if p .Version == "" {
152
154
p .Version = defaultVersion
153
155
}
156
+
157
+ if p .ImageName == "" {
158
+ p .ImageName = defaultImage
159
+ }
154
160
}
155
161
156
162
func (p * P ) executeQueries (db * sql.DB ) error {
You can’t perform that action at this time.
0 commit comments