app/products: add dependency resolver (#19847)

* app/products: add dependency resolver

* reflect review comments
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-03-29 11:58:29 +03:00
коммит произвёл GitHub
родитель aa696ba36d
Коммит d33ef8d79c
4 изменённых файлов: 221 добавлений и 14 удалений

Просмотреть файл

@@ -378,13 +378,9 @@ func NewServer(options ...Option) (*Server, error) {
// Step 8: Initialize products.
// Depends on s.httpService.
for name, initializer := range products {
prod, err2 := initializer(s, serviceMap)
if err2 != nil {
return nil, errors.Wrapf(err2, "error initializing product: %s", name)
}
s.products[name] = prod
err = s.initializeProducts(products, serviceMap)
if err != nil {
return nil, errors.Wrap(err, "failed to initialize products")
}
// It is important to initialize the hub only after the global logger is set