From 0b49ef9ec538db2617d1d24ec84514e03cfa5c48 Mon Sep 17 00:00:00 2001 From: onee-only Date: Mon, 15 Jul 2024 23:48:53 +0900 Subject: [PATCH] Fix some issues --- cmd/gen-work/main.go | 28 ++++++++++++++++------------ internal/exec/resource.go | 4 ++++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/cmd/gen-work/main.go b/cmd/gen-work/main.go index ab2d517..edb34c4 100644 --- a/cmd/gen-work/main.go +++ b/cmd/gen-work/main.go @@ -88,21 +88,25 @@ func processParameters() { taskID = uuid.MustParse(*_taskID) sectionID = uuid.MustParse(*_sectionID) - id := uuid.MustParse(*_templateID) - templateID = id[:] - - kvPairs := strings.Split(*_headers, ",") - headerMap := make(map[string]string, len(kvPairs)) - for _, pair := range kvPairs { - k, v, found := strings.Cut(pair, "=") - if !found { - log.Fatal("malformed header") + if *_templateID != "" { + id := uuid.MustParse(*_templateID) + templateID = id[:] + } + + if *_headers != "" { + kvPairs := strings.Split(*_headers, ",") + headerMap := make(map[string]string, len(kvPairs)) + for _, pair := range kvPairs { + k, v, found := strings.Cut(pair, "=") + if !found { + log.Fatal("malformed header") + } + + headerMap[k] = v } - headerMap[k] = v + headers = headerMap } - - headers = headerMap } func main() { diff --git a/internal/exec/resource.go b/internal/exec/resource.go index c3fc56f..36c28f3 100644 --- a/internal/exec/resource.go +++ b/internal/exec/resource.go @@ -65,6 +65,10 @@ func (e *Executor) setupResources( ExposedPorts: nat.PortSet{natPort: struct{}{}}, } + if resource.Name == "db" { + containerConf.Env = append(containerConf.Env, "MYSQL_ALLOW_EMPTY_PASSWORD=true") + } + hostConf := &container.HostConfig{ NetworkMode: container.NetworkMode(e.ExecNetwork), Resources: container.Resources{