()
| 346 | } |
| 347 | |
| 348 | func (c *serverCmd) setupIndexer() error { |
| 349 | args := []string{"dbinit"} |
| 350 | switch { |
| 351 | case c.postgres: |
| 352 | args = append(args, |
| 353 | "-dbtype=postgres", |
| 354 | "-user=postgres", |
| 355 | "-password=postgres", |
| 356 | "-host=localhost", |
| 357 | "-dbname="+c.env.m["CAMLI_DBNAME"]) |
| 358 | case c.mysql: |
| 359 | args = append(args, |
| 360 | "-user=root", |
| 361 | "-password=root", |
| 362 | "-host=localhost", |
| 363 | "-dbname="+c.env.m["CAMLI_DBNAME"]) |
| 364 | case c.sqlite: |
| 365 | args = append(args, |
| 366 | "-dbtype=sqlite", |
| 367 | "-dbname="+c.env.m["CAMLI_DBNAME"]) |
| 368 | case c.mongo: |
| 369 | args = append(args, |
| 370 | "-dbtype=mongo", |
| 371 | "-host=localhost", |
| 372 | "-dbname="+c.env.m["CAMLI_DBNAME"]) |
| 373 | default: |
| 374 | return nil |
| 375 | } |
| 376 | if c.wipe { |
| 377 | args = append(args, "-wipe") |
| 378 | } else { |
| 379 | args = append(args, "-ignoreexists") |
| 380 | } |
| 381 | binPath := filepath.Join("bin", "pk") |
| 382 | cmd := exec.Command(binPath, args...) |
| 383 | cmd.Stdout = os.Stdout |
| 384 | cmd.Stderr = os.Stderr |
| 385 | if err := cmd.Run(); err != nil { |
| 386 | return fmt.Errorf("Could not run pk dbinit: %v", err) |
| 387 | } |
| 388 | return nil |
| 389 | } |
| 390 | |
| 391 | func (c *serverCmd) syncTemplateBlobs() error { |
| 392 | if c.wipe { |
no test coverage detected