Example #1
0
func Configure(cfg *config.Config, version string) {

	if cfg.AutoReport != nil && *cfg.AutoReport {
		analytics.Configure(TrackingId, version, cfg.Addr)

		err := StartService()
		if err != nil {
			log.Errorf("Error starting analytics service: %q", err)
		}
	}
}
Example #2
0
// serveHTTP will run the proxy
func (client *mobileClient) serveHTTP() {
	go func() {
		onListening := func() {
			log.Debugf("Now listening for connections...")
			analytics.Configure("", trackingCodes["FireTweet"], "", client.Client.Addr)
			logging.Configure(client.Client.Addr, cloudConfigCA, instanceId, version, revisionDate)
		}

		defer func() {
			close(client.closed)
		}()

		if err := client.ListenAndServe(onListening); err != nil {
			// Error is not exported: https://golang.org/src/net/net.go#L284
			if !strings.Contains(err.Error(), "use of closed network connection") {
				panic(err.Error())
			}
		}
	}()
	go client.pollConfiguration()
}