mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
fix(config-watcher): start only if config-directory exists (#1854)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
843f93e1ab
commit
a046dcac5e
1 changed files with 9 additions and 4 deletions
13
main.go
13
main.go
|
@ -306,11 +306,16 @@ For a list of compatible model, check out: https://localai.io/model-compatibilit
|
||||||
return fmt.Errorf("failed basic startup tasks with error %s", err.Error())
|
return fmt.Errorf("failed basic startup tasks with error %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
closeConfigWatcherFn, err := startup.WatchConfigDirectory(ctx.String("localai-config-dir"), options)
|
configdir := ctx.String("localai-config-dir")
|
||||||
defer closeConfigWatcherFn()
|
// Watch the configuration directory
|
||||||
|
// If the directory does not exist, we don't watch it
|
||||||
|
if _, err := os.Stat(configdir); err == nil {
|
||||||
|
closeConfigWatcherFn, err := startup.WatchConfigDirectory(ctx.String("localai-config-dir"), options)
|
||||||
|
defer closeConfigWatcherFn()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed while watching configuration directory %s", ctx.String("localai-config-dir"))
|
return fmt.Errorf("failed while watching configuration directory %s", ctx.String("localai-config-dir"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appHTTP, err := http.App(cl, ml, options)
|
appHTTP, err := http.App(cl, ml, options)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue