75 lines
1.6 KiB
Go
75 lines
1.6 KiB
Go
package runtime
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.sendico.io/tech/sxchnge/bff/edge/shared/interface/api"
|
|
httptransport "git.sendico.io/tech/sxchnge/bff/edge/shared/internal/transport/http"
|
|
amr "git.sendico.io/tech/sxchnge/bff/pkg/api/routers"
|
|
"git.sendico.io/tech/sxchnge/bff/pkg/auth"
|
|
"git.sendico.io/tech/sxchnge/bff/pkg/db"
|
|
"git.sendico.io/tech/sxchnge/bff/pkg/domainprovider"
|
|
"git.sendico.io/tech/sxchnge/bff/pkg/mlogger"
|
|
"git.sendico.io/tech/sxchnge/bff/pkg/mservice"
|
|
)
|
|
|
|
type Microservices = []mservice.MicroService
|
|
|
|
// APIImp represents the structure of the APIImp
|
|
type APIImp struct {
|
|
lifecycleCtx context.Context
|
|
logger mlogger.Logger
|
|
db db.Factory
|
|
domain domainprovider.DomainProvider
|
|
config *api.Config
|
|
profile api.ConfigProvider
|
|
runtime api.RuntimeConfig
|
|
components api.RuntimeComponents
|
|
services Microservices
|
|
health amr.Health
|
|
mw *httptransport.Middleware
|
|
}
|
|
|
|
func (a *APIImp) LifecycleContext() context.Context {
|
|
return a.lifecycleCtx
|
|
}
|
|
|
|
func (a *APIImp) Logger() mlogger.Logger {
|
|
return a.logger
|
|
}
|
|
|
|
func (a *APIImp) Config() *api.Config {
|
|
return a.config
|
|
}
|
|
|
|
func (a *APIImp) ProfileConfig() api.ConfigProvider {
|
|
return a.profile
|
|
}
|
|
|
|
func (a *APIImp) DBFactory() db.Factory {
|
|
return a.db
|
|
}
|
|
|
|
func (a *APIImp) DomainProvider() domainprovider.DomainProvider {
|
|
return a.domain
|
|
}
|
|
|
|
func (a *APIImp) Register() api.Register {
|
|
return a.mw
|
|
}
|
|
|
|
func (a *APIImp) Permissions() auth.Provider {
|
|
return a.db.Permissions()
|
|
}
|
|
|
|
func (a *APIImp) RuntimeComponent(name string) any {
|
|
if a == nil || a.components == nil {
|
|
return nil
|
|
}
|
|
return a.components[name]
|
|
}
|
|
|
|
func (a *APIImp) Name() string {
|
|
return "api"
|
|
}
|