Skip to content

Commit 3062f63

Browse files
committed
clean up database
1 parent 9887b40 commit 3062f63

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

framework/components/postgres/postgres.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const (
2121
Port = "5432"
2222
ExposedStaticPort = "13000"
2323
Database = "chainlink"
24+
DatabaseDir = "postgresql_data"
2425
)
2526

2627
type Input struct {
@@ -92,6 +93,8 @@ func NewPostgreSQL(in *Input) (*Output, error) {
9293
if err != nil {
9394
return nil, err
9495
}
96+
_ = os.RemoveAll(filepath.Join(wd, DatabaseDir))
97+
_ = os.Mkdir(DatabaseDir, os.ModePerm)
9598
req.HostConfigModifier = func(h *container.HostConfig) {
9699
h.PortBindings = nat.PortMap{
97100
nat.Port(bindPort): []nat.PortBinding{
@@ -104,7 +107,7 @@ func NewPostgreSQL(in *Input) (*Output, error) {
104107
h.Mounts = []mount.Mount{
105108
{
106109
Type: mount.TypeBind,
107-
Source: filepath.Join(wd, "postgresql_data"),
110+
Source: filepath.Join(wd, DatabaseDir),
108111
Target: "/var/lib/postgresql/data",
109112
},
110113
}

0 commit comments

Comments
 (0)