func (s *Sls) ReadSlsFile() error {
	if len(s.FilePath) == 0 {
		return fmt.Errorf("no file path given")
	}
	if s.FilePath == os.Stdout.Name() {
		return nil
	}
	if _, statErr := os.Stat(s.FilePath); os.IsNotExist(statErr) {
		dir := filepath.Dir(s.FilePath)
		err := os.MkdirAll(dir, 0700)
		if err != nil {
			return err
		}
		_, err = os.OpenFile(s.FilePath, os.O_RDONLY|os.O_CREATE, 0600)
		if err != nil {
			return err
		}
	}
	fullPath, err := filepath.Abs(s.FilePath)
	if err != nil {
		return err
	}
	var buf []byte
	buf, err = ioutil.ReadFile(filepath.Clean(fullPath))
	if err != nil {
		return err
	}
	return s.ReadBytes(buf)
}
ReadSlsFile open and read a yaml file, if the file has include statements
we throw an error as the YAML parser will try to act on the include directives
package sls
import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"reflect"
	"strings"
	"github.com/Everbridge/generate-secure-pillar/pki"
	yaml "github.com/esilva-everbridge/yaml"
	"github.com/sirupsen/logrus"
	yamlv3 "gopkg.in/yaml.v3"
)
const Encrypt = "encrypt"
const Decrypt = "decrypt"
const Validate = "validate"
const Rotate = "rotate"
var logger = logrus.New()
type Sls struct {
	FilePath       string
	Yaml           *yaml.Yaml
	Pki            *pki.Pki
	IsInclude      bool
	EncryptionPath string
	KeyMap         map[string]interface{}
	KeyMeta        string
	KeyCount       int
	Error          error
}
func New(filePath string, p pki.Pki, encPath string) Sls {
	logger.Out = os.Stdout
	s := Sls{filePath, yaml.New(), &p, false, encPath, map[string]interface{}{}, "", 0, nil}
	if len(filePath) > 0 {
		err := s.ReadSlsFile()
		if err != nil {
			logger.Errorf("init error for %s: %s", s.FilePath, err)
			s.Error = err
		}
	}
	return s
}
func (s *Sls) ReadBytes(buf []byte) error {
	reader := strings.NewReader(string(buf))
	err := s.ScanForIncludes(reader)
	if err != nil {
		s.IsInclude = true
		logger.Warnf("%s", err)
	}
	return yamlv3.Unmarshal(buf, &s.Yaml.Values)
}
func (s *Sls) ScanForIncludes(reader io.Reader) error {
	scanner := bufio.NewScanner(reader)
	for scanner.Scan() {
		txt := scanner.Text()
		if strings.Contains(txt, "include:") {
			return fmt.Errorf("%s contains include directives", shortFileName(s.FilePath))
		}
	}
	return scanner.Err()
}