Skip to content

Commit

Permalink
Merge pull request #7 from fly-apps/fix_import
Browse files Browse the repository at this point in the history
Fix importing
  • Loading branch information
billyb2 authored Mar 25, 2024
2 parents 5138f66 + 7978f29 commit 53c0755
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ func main() {
os.Exit(1)
return
}
machineID := os.Getenv("PG_MACHINE_ID")

targetURI := fmt.Sprintf("postgres://postgres:%s@%s.internal:5432", operatorPass, appName)
appDomain := appName + ".internal"
if machineID != "" {
appDomain = machineID + ".vm." + appDomain
} else {
log.Println("[warn] PG_MACHINE_ID was not specified, falling back to resolving from app name")
}

targetURI := fmt.Sprintf("postgres://postgres:%s@%s:5432", operatorPass, appDomain)

opts := migrationOpts{
sourceURI: sourceURI,
Expand Down Expand Up @@ -174,5 +182,5 @@ func runCommand(cmdStr string) ([]byte, error) {
cmd := exec.Command("sh", "-c", cmdStr)
cmd.SysProcAttr = &syscall.SysProcAttr{}

return cmd.Output()
return cmd.CombinedOutput()
}

0 comments on commit 53c0755

Please # to comment.