mirror of
https://github.com/derfenix/photocatalog.git
synced 2026-03-11 11:52:57 +03:00
Cleanup, add ability to skip initial full sync
This commit is contained in:
@@ -50,8 +50,10 @@ func (a *Application) Start(ctx context.Context, wg *sync.WaitGroup) error {
|
||||
org = org.WithOverwrite()
|
||||
}
|
||||
|
||||
if err := org.FullSync(ctx); err != nil {
|
||||
return fmt.Errorf("full sync: %w", err)
|
||||
if !a.config.SkipFullSync {
|
||||
if err := org.FullSync(ctx); err != nil {
|
||||
return fmt.Errorf("full sync: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if a.config.Watch {
|
||||
|
||||
@@ -15,13 +15,14 @@ const (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
SourceDir string
|
||||
TargetDir string
|
||||
Mode Mode
|
||||
Overwrite bool
|
||||
DirMode uint64
|
||||
FileMode uint64
|
||||
Watch bool
|
||||
SourceDir string
|
||||
TargetDir string
|
||||
Mode Mode
|
||||
Overwrite bool
|
||||
DirMode uint64
|
||||
FileMode uint64
|
||||
Watch bool
|
||||
SkipFullSync bool
|
||||
}
|
||||
|
||||
func (c *Config) Validate() error {
|
||||
@@ -37,5 +38,9 @@ func (c *Config) Validate() error {
|
||||
return fmt.Errorf("invalid mode %s", c.Mode)
|
||||
}
|
||||
|
||||
if c.SkipFullSync && !c.Watch {
|
||||
return fmt.Errorf("skip full sync and watch disabled — nothing to do")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user