func init()

in app/eventgen/config/config.go [46:73]


func init() {
	log.SetOutput(os.Stdout)

	hostName, err := os.Hostname()
	if err != nil {
		log.Fatalf("fail to get hostname, err: %v", err)
	}
	eventCodec, err := avro.NewCodedecFromFile(env.GetEnv("EVENT_AVSC", "Event.avsc"))
	if err != nil {
		log.Fatalf("fail to create event avro codec, err: %v", err)
	}

	Config = config{
		Node:                    hostName,
		RESTPort:                env.GetEnv("REST_PORT", "8001"),
		Location:                env.GetEnv("GOOGLE_CLOUD_LOCATION", "west"),
		EventTopic:              env.GetEnv("EVENT_TOPIC", "EventTopic"),
		EventCodec:              eventCodec,
		PublisherBatchSize:      env.GetEnvInt("PUBLISHER_BATCH_SIZE", 100),
		PublisherNumGoroutines:  env.GetEnvInt("PUBLISHER_THREADS", 0), // use default 25 * GOMAXPROCS
		PublisherMaxOutstanding: env.GetEnvInt("PUBLISHER_FLOW_CONTROL_MAX_OUTSTANDING_MESSAGES", 100),
		PublisherRetryInit:      time.Duration(env.GetEnvFloat64("PUBLISHER_RETRY_INITIAL_TIMEOUT", 5) * float64(time.Second)),
		PublisherRetryTotal:     time.Duration(env.GetEnvFloat64("PUBLISHER_RETRY_TOTAL_TIMEOUT", 600) * float64(time.Second)),
		Threads:                 env.GetEnvInt("EVENT_GENERATOR_THREADS", 200),
		Timeout:                 time.Duration(env.GetEnvFloat64("EVENT_GENERATOR_RUNTIME", 5) * float64(time.Minute)),
	}
	log.Printf("using config: %+v", Config)
}