diff --git a/framework/components/jd/jd.go b/framework/components/jd/jd.go index 043f5231a..3dc37e156 100644 --- a/framework/components/jd/jd.go +++ b/framework/components/jd/jd.go @@ -54,6 +54,7 @@ func defaultJDDB() *postgres.Input { return &postgres.Input{ Image: "postgres:12", Port: 14000, + Name: "jd-db", VolumeName: "jd", JDDatabase: true, } diff --git a/framework/components/postgres/postgres.go b/framework/components/postgres/postgres.go index 6b37e3a43..46ac97557 100644 --- a/framework/components/postgres/postgres.go +++ b/framework/components/postgres/postgres.go @@ -25,6 +25,7 @@ const ( type Input struct { Image string `toml:"image" validate:"required"` Port int `toml:"port"` + Name string `toml:"name"` VolumeName string `toml:"volume_name"` Databases int `toml:"databases"` JDDatabase bool `toml:"jd_database"` @@ -44,7 +45,12 @@ func NewPostgreSQL(in *Input) (*Output, error) { ctx := context.Background() bindPort := fmt.Sprintf("%s/tcp", Port) - containerName := framework.DefaultTCName("ns-postgresql") + var containerName string + if in.Name != "" { + containerName = framework.DefaultTCName(in.Name) + } else { + containerName = framework.DefaultTCName("ns-postgresql") + } var sqlCommands []string for i := 0; i <= in.Databases; i++ {