mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-21 10:45:25 +02:00
Introduce "orchard context" (#18)
This commit is contained in:
@@ -17,6 +17,11 @@ func (controller *Controller) initAPI() *gin.Engine {
|
||||
// v1 API
|
||||
v1 := ginEngine.Group("/v1")
|
||||
|
||||
// A way to for the clients to check that the API is working
|
||||
v1.GET("/", func(c *gin.Context) {
|
||||
c.Status(http.StatusOK)
|
||||
})
|
||||
|
||||
// Workers
|
||||
v1.POST("/workers", func(c *gin.Context) {
|
||||
controller.createWorker(c).Respond(c)
|
||||
|
||||
@@ -12,6 +12,11 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultPort = 6120
|
||||
DefaultServerName = "orchard-controller"
|
||||
)
|
||||
|
||||
var ErrInitFailed = errors.New("controller initialization failed")
|
||||
|
||||
type Controller struct {
|
||||
@@ -38,7 +43,7 @@ func New(opts ...Option) (*Controller, error) {
|
||||
ErrInitFailed)
|
||||
}
|
||||
if controller.listenAddr == "" {
|
||||
controller.listenAddr = ":6120"
|
||||
controller.listenAddr = fmt.Sprintf(":%d", DefaultPort)
|
||||
}
|
||||
if controller.logger == nil {
|
||||
controller.logger = zap.NewNop().Sugar()
|
||||
|
||||
Reference in New Issue
Block a user