mirror of
https://github.com/photoprism/photoprism.git
synced 2025-11-01 12:42:52 +08:00
CLI: Refactor tests and config initialization
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -31,20 +31,19 @@ var ConvertCommand = cli.Command{
|
||||
func convertAction(ctx *cli.Context) error {
|
||||
start := time.Now()
|
||||
|
||||
conf := config.NewConfig(ctx)
|
||||
service.SetConfig(conf)
|
||||
|
||||
if !conf.SidecarWritable() {
|
||||
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
|
||||
}
|
||||
|
||||
if !conf.SidecarWritable() {
|
||||
return config.ErrReadOnly
|
||||
}
|
||||
|
||||
conf.RegisterDb()
|
||||
defer conf.Shutdown()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user