Skip to content

Commit

Permalink
Added db up before services run
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriiklymiuk committed Oct 5, 2022
1 parent 8107cc1 commit f0e69f0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,39 @@ func runRun(cmd *cobra.Command, args []string) {
return
}

isFromScratch, err := cmd.Flags().GetBool("fromScratch")
if err != nil {
return
}
if isFromScratch {
err = os.RemoveAll("./corgi_services/")
if err != nil {
fmt.Println("couldn't delete corgi_services folder: ", err)
return
}
fmt.Println("🗑️ Cleaned up corgi_services")
}

CreateDatabaseServices(corgi.DatabaseServices)

isSeed, err := cmd.Flags().GetBool("seed")
if err != nil {
return
}

if isSeed {
for _, dbService := range corgi.DatabaseServices {
if (dbService.SeedFromDb == utils.SeedDbSource{}) {
continue
}
fmt.Println(string("\n\033[34m"), "⛅ GETTING DATABASE DUMP for", dbService.ServiceName, string("\033[0m"))
GetDump(dbService)
SeedDb(dbService.ServiceName)
}
}

utils.ExecuteForEachService("up")

generateEnvForServices(corgi)

for _, service := range corgi.Services {
Expand Down

0 comments on commit f0e69f0

Please sign in to comment.