pkg/parser/fileresource.go
func ReadFromResource(r string) (string, error) {
	env := os.Getenv("KUBICORN_ENVIRONMENT")

	// Hack in here for local bootstrap override
	devMode := os.Getenv("KUBICORN_FORCE_LOCAL_BOOTSTRAP")
	if devMode != "" {
		logger.Info("Parsing bootstrap script from filesystem [%s]", r)
		return readFromFS(r)
	}

	switch {

	// -----------------------------------------------------------------------------------------------------------------
	//
	//
	// starts with bootstrap/
	//
	case strings.HasPrefix(strings.ToLower(r), "bootstrap/") && env != "LOCAL":

		// If we start with bootstrap/ we know this is a resource we should pull from github.com
		// So here we build the GitHub URL and send the request
		gitHubUrl := getGitHubUrl(r)
		logger.Info("Parsing bootstrap script from GitHub [%s]", gitHubUrl)
		url, err := url.ParseRequestURI(gitHubUrl)
		if err != nil {
			return "", err
		}
		return readFromHTTP(url)

	// -----------------------------------------------------------------------------------------------------------------
	//
	//
	// starts with http(s)://
	//
	case strings.HasPrefix(strings.ToLower(r), "http://") || strings.HasPrefix(strings.ToLower(r), "https://") && env != "LOCAL":
		url, err := url.ParseRequestURI(r)
		logger.Info("Parsing bootstrap script from url [%s]", url)
		if err != nil {
			return "", err
		}
		return readFromHTTP(url)

	// -----------------------------------------------------------------------------------------------------------------
	//
	//
	// pull from local
	//
	default:
		logger.Info("Parsing bootstrap script from filesystem [%s]", r)
		return readFromFS(r)
	}
}
func ReadFromResource(r string) (string, error) {
	env := os.Getenv("KUBICORN_ENVIRONMENT")

	// Hack in here for local bootstrap override
	devMode := os.Getenv("KUBICORN_FORCE_LOCAL_BOOTSTRAP")
	if devMode != "" {
		logger.Info("Parsing bootstrap script from filesystem [%s]", r)
		return readFromFS(r)
	}

	switch {

	// -----------------------------------------------------------------------------------------------------------------
	//
	//
	// starts with bootstrap/
	//
	case strings.HasPrefix(strings.ToLower(r), "bootstrap/") && env != "LOCAL":

		// If we start with bootstrap/ we know this is a resource we should pull from github.com
		// So here we build the GitHub URL and send the request
		gitHubUrl := getGitHubUrl(r)
		logger.Info("Parsing bootstrap script from GitHub [%s]", gitHubUrl)
		url, err := url.ParseRequestURI(gitHubUrl)
		if err != nil {
			return "", err
		}
		return readFromHTTP(url)

	// -----------------------------------------------------------------------------------------------------------------
	//
	//
	// starts with http(s)://
	//
	case strings.HasPrefix(strings.ToLower(r), "http://") || strings.HasPrefix(strings.ToLower(r), "https://") && env != "LOCAL":
		url, err := url.ParseRequestURI(r)
		logger.Info("Parsing bootstrap script from url [%s]", url)
		if err != nil {
			return "", err
		}
		return readFromHTTP(url)

	// -----------------------------------------------------------------------------------------------------------------
	//
	//
	// pull from local
	//
	default:
		logger.Info("Parsing bootstrap script from filesystem [%s]", r)
		return readFromFS(r)
	}
}
// ReadFromResource reads a file from different sources
// at the moment suppoted resources are http, http, local file system(POSIX)