GetNewHoverfly returns a configured ProxyHttpServer and DBClient
(cfg *Configuration, requestCache cache.FastCache, authentication backends.Authentication)
| 114 | |
| 115 | // GetNewHoverfly returns a configured ProxyHttpServer and DBClient |
| 116 | func GetNewHoverfly(cfg *Configuration, requestCache cache.FastCache, authentication backends.Authentication) *Hoverfly { |
| 117 | hoverfly := NewHoverfly() |
| 118 | |
| 119 | if cfg.DisableCache { |
| 120 | requestCache = nil |
| 121 | } |
| 122 | |
| 123 | hoverfly.CacheMatcher = matching.CacheMatcher{ |
| 124 | RequestCache: requestCache, |
| 125 | Webserver: cfg.Webserver, |
| 126 | } |
| 127 | |
| 128 | hoverfly.Authentication = authentication |
| 129 | hoverfly.HTTP = GetDefaultHoverflyHTTPClient(cfg.TLSVerification, cfg.UpstreamProxy) |
| 130 | hoverfly.Cfg = cfg |
| 131 | |
| 132 | return hoverfly |
| 133 | } |
| 134 | |
| 135 | // StartProxy - starts proxy with current configuration, this method is non blocking. |
| 136 | func (hf *Hoverfly) StartProxy() error { |