Example #1
0
func ReadRawProvision(file string) (*Provision, error) {
	bytes, err := utils.ReadFile(file)
	if err != nil {
		return nil, err
	}

	p, err := parseProvision(bytes)
	if err != nil {
		return nil, err
	}

	return p, nil
}
Example #2
0
func readToken() (string, error) {
	envs := make(map[string]string)
	bytes, err := utils.ReadFile(".gattai/.token")
	if err != nil {
		return "", fmt.Errorf("There is no token or cluster store set.")
	}

	err = yaml.Unmarshal(bytes, &envs)
	if err == nil {
		if value, exist := envs["CLUSTER_TOKEN"]; exist {
			return value, nil
		}
		return envs["CLUSTER_STORE"], nil
	}

	return "", err
}