mirror of
https://github.com/photoprism/photoprism.git
synced 2025-10-05 00:43:09 +08:00
CLI: Refactor tests and config initialization
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -34,21 +34,20 @@ var CopyCommand = cli.Command{
|
||||
func copyAction(ctx *cli.Context) error {
|
||||
start := time.Now()
|
||||
|
||||
conf := config.NewConfig(ctx)
|
||||
service.SetConfig(conf)
|
||||
|
||||
// very if copy directory exist and is writable
|
||||
if conf.ReadOnly() {
|
||||
return config.ErrReadOnly
|
||||
}
|
||||
conf, err := InitConfig(ctx)
|
||||
|
||||
_, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
if err := conf.Init(); err != nil {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// very if copy directory exist and is writable
|
||||
if conf.ReadOnly() {
|
||||
return config.ErrReadOnly
|
||||
}
|
||||
|
||||
conf.InitDb()
|
||||
defer conf.Shutdown()
|
||||
|
||||
|
Reference in New Issue
Block a user