Skip to content

Commit

Permalink
Added checking docker status before db run
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriiklymiuk committed Oct 5, 2022
1 parent 072fd29 commit e0ddaf2
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,31 @@ func runRun(cmd *cobra.Command, args []string) {

CreateDatabaseServices(corgi.DatabaseServices)

runDatabaseServices(cmd, corgi.DatabaseServices)

generateEnvForServices(corgi)

for _, service := range corgi.Services {
servicesWaitGroup.Add(1)
go runService(service, cmd)
}
servicesWaitGroup.Wait()
}

func runDatabaseServices(cmd *cobra.Command, databaseServices []utils.DatabaseService) {
isSeed, err := cmd.Flags().GetBool("seed")
if err != nil {
return
}

err = utils.DockerInit()
if err != nil {
fmt.Println(err)
return
}

if isSeed {
for _, dbService := range corgi.DatabaseServices {
for _, dbService := range databaseServices {
if (dbService.SeedFromDb == utils.SeedDbSource{}) {
continue
}
Expand All @@ -89,14 +107,6 @@ func runRun(cmd *cobra.Command, args []string) {
}

utils.ExecuteForEachService("up")

generateEnvForServices(corgi)

for _, service := range corgi.Services {
servicesWaitGroup.Add(1)
go runService(service, cmd)
}
servicesWaitGroup.Wait()
}

func runService(service utils.Service, cobraCmd *cobra.Command) {
Expand Down

0 comments on commit e0ddaf2

Please sign in to comment.