Files
fx-serverless/handlers/infra_deactivate.go
Minghe 73f3a3853f move up handle to handlers (#247)
* * done move handle codes to handlers pkg
* support force deploy a function

* fix remote host issue
2019-08-31 18:55:58 +08:00

26 lines
592 B
Go

package handlers
import (
"github.com/apex/log"
"github.com/metrue/fx/config"
"github.com/metrue/fx/constants"
"github.com/urfave/cli"
)
// Deactivate a machine
func Deactivate(cfg config.Configer) HandleFunc {
return func(ctx *cli.Context) error {
name := ctx.Args().First()
if name == "" {
log.Fatalf("name required for: fx infra activate <name>")
return nil
}
if err := cfg.DisableMachine(name); err != nil {
log.Fatalf("could not disable %s: %v", name, err)
return nil
}
log.Infof("machine %s deactive: %v", name, constants.CheckedSymbol)
return nil
}
}