func (s *State) Load() {
	if s.Config.Path == "" {
		log.Fatal("State file must be defined")
	}
	log.Debugf("Loading from statefile: %v", s.Config.Path)
	if _, err := os.Stat(s.Config.Path); os.IsNotExist(err) {
		log.Fatalf("State file not found at location: %s, use 'strongbox init' to generate an empty one.\n", s.Config.Path)
	}
	filename, _ := filepath.Abs(s.Config.Path)
	data, err := ioutil.ReadFile(filepath.Clean(filename))
	if err != nil {
		log.Fatal("Error: State file not found, create a new one using : 'strongbox init'")
	}
	err = yaml.Unmarshal(data, &s)
	if err != nil {
		log.Fatalf("Error: %v", err)
	}
	log.Debugf("Loaded Transit Key: %v", s.VaultTransitKey())
	log.Debugf("Loaded KV Path: %v", s.VaultKVPath())
	log.Debugf("Loaded KV Version: %v", s.VaultKVVersion())
	log.Debugf("Loaded Secrets: %#v", s.Secrets)
}
Load : Loads the statefile content in memory
package cmd
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strconv"
	"github.com/olekukonko/tablewriter"
	log "github.com/sirupsen/logrus"
	"gopkg.in/yaml.v3"
)
type State struct {
	Vault struct {
		TransitKey string
		KV         struct {
			Path    string
			Version int
		}
	}
	Secrets map[string]map[string]string
	Config  *StateConfig `yaml:"-"`
}
type StateConfig struct {
	Path string
}
func getStateClient(sc *StateConfig) *State {
	return &State{
		Config: sc,
	}
}
func (s *State) Init() {
	log.Infof("Creating an empty state file at %v", s.Config.Path)
	s.SetVaultTransitKey("default")
	s.SetVaultKVPath("secret/")
	s.SetVaultKVVersion(2)
	s.save()
}
func (s *State) SetVaultTransitKey(value string) {
	s.Vault.TransitKey = value
	s.save()
}
func (s *State) VaultTransitKey() string {
	return s.Vault.TransitKey
}
func (s *State) SetVaultKVPath(value string) {
	s.Vault.KV.Path = value
	s.save()
}
func (s *State) VaultKVPath() string {
	if s.Vault.KV.Path == "" {
		return "secret/"
	}
	return s.Vault.KV.Path
}
func (s *State) SetVaultKVVersion(version int) {
	s.Vault.KV.Version = version
	s.save()
}
func (s *State) VaultKVVersion() int {
	if s.Vault.KV.Version == 0 {
		return 1
	}
	return s.Vault.KV.Version
}