Some small cleanup to docs.

This commit is contained in:
Travis Reeder
2017-05-26 18:54:26 +00:00
committed by Reed Allman
parent ed46a61f51
commit 69f0201818
13 changed files with 92 additions and 107 deletions

View File

@@ -14,12 +14,12 @@ import (
"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
"gitlab.oracledx.com/odx/functions/api"
"gitlab.oracledx.com/odx/functions/api/models"
"gitlab.oracledx.com/odx/functions/api/runner"
"gitlab.oracledx.com/odx/functions/api/runner/task"
"gitlab.oracledx.com/odx/functions/api/runner/common"
uuid "github.com/satori/go.uuid"
"gitlab.oracledx.com/odx/functions/api/runner/task"
)
type runnerResponse struct {
@@ -162,13 +162,14 @@ func (s *Server) serve(ctx context.Context, c *gin.Context, appName string, foun
var stdout bytes.Buffer // TODO: should limit the size of this, error if gets too big. akin to: https://golang.org/pkg/io/#LimitReader
envVars := map[string]string{
"METHOD": c.Request.Method,
"ROUTE": found.Path,
"METHOD": c.Request.Method,
"ROUTE": found.Path,
"REQUEST_URL": fmt.Sprintf("%v//%v%v", func() string {
if c.Request.TLS == nil {
return "http"
}
return "https"}(), c.Request.Host, c.Request.URL.String()),
return "https"
}(), c.Request.Host, c.Request.URL.String()),
}
// app config
@@ -190,18 +191,26 @@ func (s *Server) serve(ctx context.Context, c *gin.Context, appName string, foun
}
cfg := &task.Config{
AppName: appName,
Path: found.Path,
Env: envVars,
Format: found.Format,
ID: reqID,
Image: found.Image,
MaxConcurrency: found.MaxConcurrency,
Memory: found.Memory,
Stdin: payload,
Stdout: &stdout,
Timeout: time.Duration(found.Timeout) * time.Second,
IdleTimeout: time.Duration(found.IdleTimeout) * time.Second,
AppName: appName,
Path: found.Path,
Env: envVars,
Format: found.Format,
ID: reqID,
Image: found.Image,
MaxConcurrency: found.MaxConcurrency,
Memory: found.Memory,
Stdin: payload,
Stdout: &stdout,
Timeout: time.Duration(found.Timeout) * time.Second,
IdleTimeout: time.Duration(found.IdleTimeout) * time.Second,
}
// ensure valid values
if cfg.Timeout <= 0 {
cfg.Timeout = DefaultTimeout
}
if cfg.IdleTimeout <= 0 {
cfg.IdleTimeout = DefaultIdleTimeout
}
s.Runner.Enqueue()