MCPcopy
hub / github.com/perkeep/perkeep / setupIndexer

Method setupIndexer

dev/devcam/server.go:348–389  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

346}
347
348func (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
391func (c *serverCmd) syncTemplateBlobs() error {
392 if c.wipe {

Callers 1

RunCommandMethod · 0.95

Calls 2

CommandMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected