func (si *ServiceInstance) Unbind(app bind.App) error { err := si.RemoveApp(app.GetName()) if err != nil { return &errors.Http{Code: http.StatusPreconditionFailed, Message: "This app is not binded to this service instance."} } err = si.update() if err != nil { return err } go func() { si.Service().ProductionEndpoint().Unbind(si, app) }() var envVars []string for k := range app.InstanceEnv(si.Name) { envVars = append(envVars, k) } return app.UnsetEnvs(envVars, false) }