Skip to content
Snippets Groups Projects
Commit 72f9522c authored by Steffen Schulze's avatar Steffen Schulze
Browse files

logging added, and compose files modified

parent eab1e050
No related branches found
No related tags found
1 merge request!10Refactoring
Pipeline #41178 passed with warnings with stages
in 2 minutes and 40 seconds
......@@ -27,6 +27,7 @@ services:
- DIDCOMMCONNECTOR_DATBASE_PORT=9042
- DIDCOMMCONNECTOR_CLOUDFORWARDING_NATS_TOPIC=connector
- DIDCOMMCONNECTOR_URL=http://localhost:9092
- DIDCOMMCONNECTOR_CLOUDFORWARDING_PROTOCOL=nats
networks:
- test
......
......@@ -27,6 +27,7 @@ services:
- DIDCOMMCONNECTOR_DATBASE_PORT=9042
- DIDCOMMCONNECTOR_CLOUDFORWARDING_NATS_TOPIC=connector
- DIDCOMMCONNECTOR_URL=http://localhost:9092
- DIDCOMMCONNECTOR_CLOUDFORWARDING_PROTOCOL=nats
networks:
- test
......
......@@ -120,7 +120,7 @@ func GetHttpResult(input interface{}, url string, bearer string) (map[string]int
derr := json.NewDecoder(res.Body).Decode(&post)
if derr != nil {
return nil, err
return nil, derr
}
return post, nil
......
......@@ -71,7 +71,7 @@ func (rt *Routing) handleForward(message didcomm.Message, inbound bool) (pr Prob
}
if isMediated {
config.Logger.Debug("Next is registered as mediator, park message in outbox.")
err = rt.mediator.Database.AddMessage(body.Next, attachment)
if err != nil {
config.Logger.Error("could not add message to inbox", "err", err)
......@@ -95,7 +95,7 @@ func (rt *Routing) handleForward(message didcomm.Message, inbound bool) (pr Prob
if !inbound {
//In the case of a did here must be later on a decision if a service endpoint should be used or
//to use the message box. for now is it the messagebox
config.Logger.Debug("Message is outgoing, resolve did")
didDoc, err := rt.mediator.DidResolver.ResolveDid(body.Next)
if err != nil {
......@@ -106,6 +106,7 @@ func (rt *Routing) handleForward(message didcomm.Message, inbound bool) (pr Prob
The peer did for a device has no endpoint where you try to send to
*/
if len(didDoc.Service) == 0 {
config.Logger.Debug("No direct forwarding possible (no service found), park message in outbox")
err = rt.mediator.Database.AddMessage(body.Next, attachment)
if err != nil {
config.Logger.Error("could not add message to inbox", "err", err)
......@@ -115,6 +116,7 @@ func (rt *Routing) handleForward(message didcomm.Message, inbound bool) (pr Prob
/*
if service endpoint exists which is didcomm compatible, forward message as it is.
*/
config.Logger.Debug("Endpoint found within did, post it to there directly")
for _, x := range didDoc.Service {
val, ok := x.ServiceEndpoint.(didcomm.ServiceKindDidCommMessaging)
......@@ -130,8 +132,14 @@ func (rt *Routing) handleForward(message didcomm.Message, inbound bool) (pr Prob
/*
Here should be later an seperation between cloud and attachment forward. E.g. by using different service endpoints within the routing did
*/
if ... {
ForwardMessageAttachment...
} else
*/
config.Logger.Debug("Incoming message, handle it as normal mediation and forward b64 attachment")
messageB64 := attachment.Data.(didcomm.AttachmentDataBase64).Value.Base64
messageDecoded, err := base64.StdEncoding.DecodeString(messageB64)
if err != nil {
......@@ -166,8 +174,8 @@ func (rt *Routing) handleForward(message didcomm.Message, inbound bool) (pr Prob
}
func (rt *Routing) ForwardMessage(message didcomm.Message, endpoint string) (pr ProblemReport, err error) {
packMsg, err := rt.mediator.PackPlainMessage(message)
to := *message.To
packMsg, err := packMessage(to[0], *message.From, message, rt.mediator)
if err != nil {
config.Logger.Error("Problem Report", "err", err)
return didcomm.Message{}, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment