Skip to content

Commit

Permalink
Merge pull request #66 from tarmac-project/littlethings
Browse files Browse the repository at this point in the history
Little things that are useful - Logging and Default CA Certs update
  • Loading branch information
madflojo authored Oct 15, 2023
2 parents 673fb94 + d9a5b42 commit 0c6c055
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RUN go install -v .
WORKDIR /go/src/github.com/tarmac-project/tarmac/

FROM ubuntu:latest
# Install latest CA certificates
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && update-ca-certificates
RUN install -d -m 0755 -o 1000 -g 500 /app/tarmac
# Create Data directory for local data storage, override with volume mounts to retain data
RUN install -d -m 0755 -o 1000 -g 500 /data/tarmac
Expand Down
20 changes: 16 additions & 4 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (srv *Server) Run() error {
srv.log.WithFields(logrus.Fields{
"namespace": namespace,
"function": op,
}).Tracef("CallbackRouter called with payload %s", data)
}).Tracef("CallbackRouter called with payload - %s", data)
return []byte(""), nil
},
PostFunc: func(r callbacks.CallbackResult) {
Expand Down Expand Up @@ -448,11 +448,17 @@ func (srv *Server) Run() error {
if err != nil {
return fmt.Errorf("could not load function %s from path %s - %s", fName, fCfg.Filepath, err)
}
srv.log.Infof("Loaded Function %s for Service %s", fName, svcName)
srv.log.WithFields(logrus.Fields{
"function": fName,
"service": svcName,
"filepath": fCfg.Filepath,
}).Infof("Loaded Function %s for Service %s with filepath of %s", fName, svcName, fCfg.Filepath)
}

// Register Routes
srv.log.Infof("Registering Routes from Service %s", svcName)
srv.log.WithFields(logrus.Fields{
"service": svcName,
}).Infof("Registering Routes from Service %s", svcName)
funcRoutes := make(map[string]string)
initRoutes := []string{}
for _, r := range svcCfg.Routes {
Expand All @@ -465,7 +471,13 @@ func (srv *Server) Run() error {
if r.Type == "http" {
for _, m := range r.Methods {
key := fmt.Sprintf("%s:%s:%s", r.Type, m, r.Path)
srv.log.Infof("Registering Route %s for function %s", key, r.Function)
srv.log.WithFields(logrus.Fields{
"function": r.Function,
"method": m,
"path": r.Path,
"function_type": r.Type,
"service": svcName,
}).Infof("Registering Route %s for function %s", key, r.Function)
funcRoutes[key] = r.Function
srv.httpRouter.Handle(m, r.Path, srv.middleware(srv.WASMHandler))
}
Expand Down

0 comments on commit 0c6c055

Please sign in to comment.