func instanceFromEnv()

in cmd/root.go [429:455]


func instanceFromEnv(args []string) []string {
	// This supports naming the first instance first with:
	//     INSTANCE_URI
	// or if that's not defined, with:
	//     INSTANCE_URI_0
	inst := os.Getenv(fmt.Sprintf("%s_INSTANCE_URI", envPrefix))
	if inst == "" {
		inst = os.Getenv(fmt.Sprintf("%s_INSTANCE_URI_0", envPrefix))
		if inst == "" {
			return nil
		}
	}
	args = append(args, inst)

	i := 1
	for {
		instN := os.Getenv(fmt.Sprintf("%s_INSTANCE_URI_%d", envPrefix, i))
		// if the next instance connection name is not defined, stop checking
		// environment variables.
		if instN == "" {
			break
		}
		args = append(args, instN)
		i++
	}
	return args
}