func()

in src/main.go [125:182]


func (cfg *config) configure() {
	// Read PORT to listen on
	cfg.port = "8080"
	port := os.Getenv("PORT")
	if port != "" {
		cfg.port = port
	}

	// Set admin GCP project, which holds BQ reservations/assignments
	cfg.project = os.Getenv("GOOGLE_CLOUD_PROJECT")

	// Configure locations for resolution of BQ reservations
	cfg.locations = []string{
		"US",
		"EU",
		"asia-east1",
		"asia-east2",
		"asia-northeast1",
		"asia-northeast2",
		"asia-northeast3",
		"asia-south1",
		"asia-south2",
		"asia-southeast1",
		"asia-southeast2",
		"australia-southeast1",
		"australia-southeast2",
		"europe-central2",
		"europe-north1",
		"europe-west1",
		"europe-west2",
		"europe-west3",
		"europe-west4",
		"europe-west5",
		"europe-west6",
		"northamerica-northeast1",
		"northamerica-northeast2",
		"southamerica-east1",
		// "southamerica-west1", # Endpoint unavailable
		"us-central1",
		"us-east1",
		"us-east4",
		"us-west1",
		"us-west2",
		"us-west3",
		"us-west4",
	}

	// Sets alerting threshold for utilization alarms
	thres, err := strconv.ParseFloat(os.Getenv("USAGE_THRESHOLD"), 64)
	if err != nil {
		log.Println("failed to parse threshold from USAGE_THRESHOLD, defaulting to 0.8")
		thres = 0.8
	}
	cfg.threshold = thres

	//Bucket to dump state to
	cfg.bucket = os.Getenv("STATE_BUCKET")
}