Ejemplo n.º 1
0
func actionDeploy(ctx *cli.Context) {
	host := ""
	adminEnv := flagAdminEnv
	if strings.HasSuffix(adminEnv, ".lever") {
		host = detectLeverOSIPPort()
	}
	if flagHost != "" {
		host = flagHost
	}

	destEnv := flagEnv
	serviceDir := ctx.Args().Get(0)
	if serviceDir == "" {
		serviceDir = "."
	}
	err := admin.DeployServiceDir(
		adminEnv, host, destEnv, serviceDir)
	if err != nil {
		logger.WithFields("err", err).Fatal("Error trying to deploy service")
	}
}
Ejemplo n.º 2
0
func TestMain(m *testing.M) {
	config.Initialize()
	leverutil.UpdateLoggingSettings()

	logger.Info("Deploying...")
	err := admin.DeployServiceDir(
		core.AdminEnvFlag.Get(), core.DefaultDevAliasFlag.Get(),
		core.DefaultDevEnvFlag.Get(), serviceName)
	if err != nil {
		logger.WithFields("err", err).Fatal("Error when deploying")
	}
	logger.Info("Deployed")
	client, err = api.NewClient()
	if err != nil {
		logger.WithFields("err", err).Fatal("Error getting client")
	}
	client.ForceHost = core.DefaultDevAliasFlag.Get()
	leverService = client.Service(core.DefaultDevEnvFlag.Get(), serviceName)
	logger.Info("Running tests...")
	os.Exit(m.Run())
}