Skip to content
Snippets Groups Projects

HTTP endpoint to import trusted data

Merged Lyuben Penkovski requested to merge 7-import-trusted-data into main
9 files
+ 378
10
Compare changes
  • Side-by-side
  • Inline
Files
9
+ 13
1
@@ -18,6 +18,7 @@ import (
"golang.org/x/sync/errgroup"
"code.vereign.com/gaiax/tsa/golib/cache"
"code.vereign.com/gaiax/tsa/golib/goadec"
"code.vereign.com/gaiax/tsa/golib/graceful"
goahealth "code.vereign.com/gaiax/tsa/infohub/gen/health"
goahealthsrv "code.vereign.com/gaiax/tsa/infohub/gen/http/health/server"
@@ -41,7 +42,7 @@ func main() {
// load configuration from environment
var cfg config.Config
if err := envconfig.Process("", &cfg); err != nil {
log.Fatalf("cannot load configuration: %v", err)
log.Fatalf("cannot load configuration: %v\n", err)
}
// create logger
@@ -134,6 +135,17 @@ func main() {
openapiServer = goaopenapisrv.New(openapiEndpoints, mux, dec, enc, nil, errFormatter, nil, nil)
}
// set custom request decoder, so that request body bytes are simply
// read and not decoded in some other way
infohubServer.Import = goainfohubsrv.NewImportHandler(
infohubEndpoints.Import,
mux,
goadec.BytesDecoder,
enc,
nil,
errFormatter,
)
// Configure the mux.
goainfohubsrv.Mount(mux, infohubServer)
goahealthsrv.Mount(mux, healthServer)
Loading