(source string)
| 17 | ) |
| 18 | |
| 19 | func reload(source string) (err error) { |
| 20 | fmt.Println("source:", conf.RELOAD) |
| 21 | if strings.HasPrefix(conf.RELOAD, "http://") { |
| 22 | fmt.Println("source-type: url") |
| 23 | if err = reloadDB(); err != nil { |
| 24 | return err |
| 25 | } |
| 26 | return reloadFromUrl(source) |
| 27 | } else { |
| 28 | fmt.Println("source-type: dir") |
| 29 | if source == conf.PATH_DATA { |
| 30 | fmt.Println("source dir is the same as conf data dir: db reload only.") |
| 31 | } else { |
| 32 | return errors.New("source dir is not the same as conf data dir: copy not implemented yet") |
| 33 | } |
| 34 | if err = reloadDB(); err != nil { |
| 35 | return err |
| 36 | } |
| 37 | return filepath.Walk(source, reloadFromDir) |
| 38 | } |
| 39 | return |
| 40 | } |
| 41 | |
| 42 | func reloadDB() (err error) { |
| 43 | fmt.Printf("dropping & re-initializing database...") |
no test coverage detected