mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-08 05:09:46 -06:00
add recover branch
This commit is contained in:
@@ -93,6 +93,16 @@ func (s Service) buildIndex() (*indexer.Indexer, error) {
|
||||
func configFromSvc(cfg *config.Config) (*idxcfg.Config, error) {
|
||||
c := idxcfg.New()
|
||||
|
||||
defer func(cfg *config.Config) {
|
||||
l := log.NewLogger(log.Color(cfg.Log.Color), log.Pretty(cfg.Log.Pretty), log.Level(cfg.Log.Level))
|
||||
if r := recover(); r != nil {
|
||||
l.Error().
|
||||
Str("panic", "recovered from panic while parsing index config from service configuration").
|
||||
Interface("svc_config", cfg).
|
||||
Msg("recovered from panic")
|
||||
}
|
||||
}(cfg)
|
||||
|
||||
if &cfg.Repo.Disk != nil {
|
||||
c.Repo = idxcfg.Repo{
|
||||
Disk: idxcfg.Disk{
|
||||
@@ -123,6 +133,10 @@ func configFromSvc(cfg *config.Config) (*idxcfg.Config, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if &cfg.ServiceUser != nil {
|
||||
c.ServiceUser = cfg.ServiceUser
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user