Files
pgbackweb/cmd/goose/main.go
Luis Eduardo Jeréz Girón 4dd0b7ab4b Disable env logs in goose cmd
2024-07-20 16:31:32 -06:00

38 lines
575 B
Go

package main
import (
"fmt"
"os"
"github.com/eduardolat/pgbackweb/internal/config"
)
const migrationsFolder string = "./internal/database/migrations"
func main() {
if len(os.Args) < 2 {
fmt.Println("goose command is required")
fmt.Println("example: task goose -- up")
return
}
gooseCmd := ""
for i, arg := range os.Args {
if i == 0 {
continue
}
gooseCmd += arg + " "
}
env := config.GetEnv(true)
cmd := fmt.Sprintf(
"goose -dir %s postgres \"%s\" %s",
migrationsFolder,
*env.PBW_POSTGRES_CONN_STRING,
gooseCmd,
)
fmt.Println(cmd)
}