Possibility to register app without creating the container
This commit is contained in:
parent
865a9a187e
commit
6d0f6ca130
5
main.go
5
main.go
@ -96,7 +96,10 @@ func main() {
|
||||
})
|
||||
|
||||
// Create a new app
|
||||
// If you add register=1 into query string, it won't start or create any container, just adds record into the database.
|
||||
e.POST("/v1/apps", func(c echo.Context) error {
|
||||
registerOnly := c.QueryParam("register") == "1"
|
||||
|
||||
app := apps.App{}
|
||||
err := c.Bind(&app)
|
||||
if err != nil {
|
||||
@ -111,6 +114,7 @@ func main() {
|
||||
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
|
||||
}
|
||||
|
||||
if !registerOnly {
|
||||
container := docker.Container{
|
||||
App: &app,
|
||||
}
|
||||
@ -124,6 +128,7 @@ func main() {
|
||||
if err != nil {
|
||||
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
|
||||
}
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, Message{Message: "ok"})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user