func upLocalDockerPg() error { conn := createPgConn() containerName := flagUpContainerName if err := lib.EnsureDockerWorking(); err != nil { return err } if !lib.IsContainerExist(containerName) { if err := lib.RunContainer(containerName, []string{ "-e", fmt.Sprintf("POSTGRES_USER=%s", conn.Username), "-e", fmt.Sprintf("POSTGRES_PASSWORD=%s", conn.Password), "-p", fmt.Sprintf("%d:5432", conn.Port), "-d", }, flagImageName); err != nil { return err } fmt.Println("Running container " + containerName) } else { fmt.Println("Container " + containerName + " is already running.") } if err := lib.TryPgConnection(conn, flagPollDbAttempt); err != nil { return err } fmt.Println(fmt.Sprintf("%s:%d is ready to use!", conn.Host, conn.Port)) return nil }
func upPg() error { conn := createPgConn() if err := lib.TryPgConnection(conn, flagPollDbAttempt); err != nil { return err } fmt.Println(fmt.Sprintf("%s:%d is ready to use!", conn.Host, conn.Port)) return nil }