github.com/angryronald/go-kit@v0.0.0-20240505173814-ff2bd9c79dbf/test/docker/vault/vault.docker-compose.go (about) 1 package vault 2 3 // not working due to when it is acting like a library the docker-compose.yaml file is not found 4 /* 5 import ( 6 "os" 7 "os/exec" 8 9 "github.com/sirupsen/logrus" 10 ) 11 12 func StartVault() string { 13 // Define the command you want to run 14 cmd := exec.Command("docker-compose", "up", "-d") 15 16 // Set the working directory to the location of your docker-compose.yml file 17 cmd.Dir = "." 18 19 // Capture and print the command's output 20 output, err := cmd.CombinedOutput() 21 if err != nil { 22 logrus.Debug("Error:", err) 23 os.Exit(1) 24 } 25 26 logrus.Debug("Command Output:", string(output)) 27 28 cmd = exec.Command("docker", "ps", "-a") 29 30 // Capture and print the command's output 31 output, err = cmd.CombinedOutput() 32 if err != nil { 33 logrus.Debug("Error:", err) 34 os.Exit(1) 35 } 36 37 logrus.Debug("Command Output:", string(output)) 38 39 return vaultTestRootToken 40 } 41 42 func StopVault() { 43 // Define the command you want to run 44 cmd := exec.Command("docker-compose", "down") 45 46 // Set the working directory to the location of your docker-compose.yml file 47 cmd.Dir = "." 48 49 // Capture and print the command's output 50 output, err := cmd.CombinedOutput() 51 if err != nil { 52 logrus.Debug("Error:", err) 53 os.Exit(1) 54 } 55 56 logrus.Debugf("Command Output:", string(output)) 57 } 58 */