* request a port when not port given * make context an interface, for easy testing (#380)
31 lines
615 B
Go
31 lines
615 B
Go
package handlers
|
|
|
|
import (
|
|
"github.com/metrue/fx/context"
|
|
"github.com/metrue/fx/deploy"
|
|
"github.com/metrue/fx/pkg/spinner"
|
|
"github.com/metrue/fx/types"
|
|
)
|
|
|
|
// Up command handle
|
|
func Up(ctx context.Contexter) (err error) {
|
|
const task = "deploying"
|
|
spinner.Start(task)
|
|
defer func() {
|
|
spinner.Stop(task, err)
|
|
}()
|
|
|
|
fn := ctx.Get("fn").(types.Func)
|
|
image := ctx.Get("image").(string)
|
|
name := ctx.Get("name").(string)
|
|
deployer := ctx.Get("deployer").(deploy.Deployer)
|
|
bindings := ctx.Get("bindings").([]types.PortBinding)
|
|
return deployer.Deploy(
|
|
ctx.GetContext(),
|
|
fn,
|
|
name,
|
|
image,
|
|
bindings,
|
|
)
|
|
}
|