MSP-8974 add download flow, server migration to http
This commit is contained in:
1 parent
4e01670ceb
commit
9aeb791c53
46 files changed
+5102
-124
No files matched your search
+12
-11
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/txix-open/isp-kit/dbrx"
|
||||
"github.com/txix-open/isp-kit/dbx"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc"
|
||||
"github.com/txix-open/isp-kit/http"
|
||||
"github.com/txix-open/isp-kit/http/httpcli"
|
||||
"github.com/txix-open/isp-kit/http/httpclix"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
@@ -24,12 +24,13 @@ import (
|
||||
)
|
||||
|
||||
type Assembly struct {
|
||||
boot *bootstrap.Bootstrap
|
||||
db *dbrx.Client
|
||||
server *grpc.Server
|
||||
oauthCli *httpcli.Client
|
||||
logger *log.Adapter
|
||||
bgjobCli *bgjobx.Client
|
||||
boot *bootstrap.Bootstrap
|
||||
db *dbrx.Client
|
||||
server *http.Server
|
||||
downloadCli *httpcli.Client
|
||||
oauthCli *httpcli.Client
|
||||
logger *log.Adapter
|
||||
bgjobCli *bgjobx.Client
|
||||
}
|
||||
|
||||
func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
|
||||
@@ -43,7 +44,7 @@ func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
|
||||
return &Assembly{
|
||||
boot: boot,
|
||||
db: db,
|
||||
server: grpc.NewServer(),
|
||||
server: http.NewServer(logger),
|
||||
logger: logger,
|
||||
oauthCli: httpclix.Default(httpcli.WithMiddlewares(httpclix.Log(wrappedLogger))),
|
||||
bgjobCli: bgjobCli,
|
||||
@@ -73,7 +74,7 @@ func (a *Assembly) ReceiveConfig(ctx context.Context, remoteConfig []byte) error
|
||||
}
|
||||
a.oauthCli.GlobalRequestConfig().BaseUrl = oauthBaseUrl
|
||||
|
||||
locator := NewLocator(a.logger, a.oauthCli, a.db)
|
||||
locator := NewLocator(a.logger, a.oauthCli, a.downloadCli, a.db)
|
||||
config, err := locator.Config(ctx, newCfg, time.Minute)
|
||||
if err != nil {
|
||||
a.logger.Fatal(ctx, errors.WithMessage(err, "locator config"))
|
||||
@@ -109,7 +110,7 @@ func (a *Assembly) Runners() []app.Runner {
|
||||
app.RunnerFunc(func(ctx context.Context) error {
|
||||
err := a.server.ListenAndServe(a.boot.BindingAddress)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "listen ans serve grpc server")
|
||||
return errors.WithMessage(err, "listen and serve http server")
|
||||
}
|
||||
return nil
|
||||
}),
|
||||
@@ -127,7 +128,7 @@ func (a *Assembly) Closers() []app.Closer {
|
||||
return []app.Closer{
|
||||
a.boot.ClusterCli,
|
||||
app.CloserFunc(func() error {
|
||||
a.server.Shutdown()
|
||||
a.server.Shutdown(context.Background())
|
||||
return nil
|
||||
}),
|
||||
app.CloserFunc(func() error {
|
||||
|
||||
Reference in new issue
Block a user