package actions import ( "fmt" "os" "flow/services/internal" "flow/services/internal/config" "github.com/magefile/mage/sh" ) func Shutdown(environment string) error { cfg, err := config.NewConfig(environment) if err != nil { return fmt.Errorf("unable to load the configuration; %w", err) } if err := shutdown(cfg.Docker.Host, environment); err != nil { return fmt.Errorf("unable to shutdown the %q environment; %w", environment, err) } return nil } func shutdown(dockerHost, environment string) error { os.Setenv("DOCKER_HOST", dockerHost) command := []string{ "docker", "compose", "--project-directory", fmt.Sprintf("%s/%s/compose", internal.RootBuildDir, environment), "down", } return sh.RunV(command[0], command[1:]...) }