func (storage Storage) Type() string {
	var storageType []string
	for k := range storage {
		storageType = append(storageType, k)
	}
	if len(storageType) > 1 {
		panic("multiple storage drivers specified in configuration or environment: " + strings.Join(storageType, ", "))
	}
	if len(storageType) == 1 {
		return storageType[0]
	}
	return ""
}
Type returns the storage driver type, such as filesystem or s3
package config
import (
	"fmt"
	"io"
	"io/ioutil"
	"strings"
	"time"
	"google.golang.org/grpc/keepalive"
	"github.com/opentrx/seata-golang/v2/pkg/util/log"
	"github.com/opentrx/seata-golang/v2/pkg/util/parser"
)
type Configuration struct {
	Server struct {
		Port                             int   `yaml:"port"`
		MaxCommitRetryTimeout            int64 `yaml:"maxCommitRetryTimeout"`
		MaxRollbackRetryTimeout          int64 `yaml:"maxRollbackRetryTimeout"`
		RollbackRetryTimeoutUnlockEnable bool  `yaml:"rollbackRetryTimeoutUnlockEnable"`
		AsyncCommittingRetryPeriod time.Duration `yaml:"asyncCommittingRetryPeriod"`
		CommittingRetryPeriod      time.Duration `yaml:"committingRetryPeriod"`
		RollingBackRetryPeriod     time.Duration `yaml:"rollingBackRetryPeriod"`
		TimeoutRetryPeriod         time.Duration `yaml:"timeoutRetryPeriod"`
		StreamMessageTimeout time.Duration `yaml:"streamMessageTimeout"`
	} `yaml:"server"`
	EnforcementPolicy struct {
		MinTime             time.Duration `yaml:"minTime"`
		PermitWithoutStream bool          `yaml:"permitWithoutStream"`
	} `yaml:"enforcementPolicy"`
	ServerParameters struct {
		MaxConnectionIdle     time.Duration `yaml:"maxConnectionIdle"`
		MaxConnectionAge      time.Duration `yaml:"maxConnectionAge"`
		MaxConnectionAgeGrace time.Duration `yaml:"maxConnectionAgeGrace"`
		Time                  time.Duration `yaml:"time"`
		Timeout               time.Duration `yaml:"timeout"`
	} `yaml:"serverParameters"`
	Storage Storage `yaml:"storage"`
	Log struct {
		LogPath  string    `yaml:"logPath"`
		LogLevel log.Level `yaml:"logLevel"`
	} `yaml:"log"`
}
func (configuration *Configuration) GetEnforcementPolicy() keepalive.EnforcementPolicy {
	ep := keepalive.EnforcementPolicy{
		MinTime:             5 * time.Second,
		PermitWithoutStream: true,
	}
	if configuration.EnforcementPolicy.MinTime > 0 {
		ep.MinTime = configuration.EnforcementPolicy.MinTime
	}
	ep.PermitWithoutStream = configuration.EnforcementPolicy.PermitWithoutStream
	return ep
}
func (configuration *Configuration) GetServerParameters() keepalive.ServerParameters {
	sp := keepalive.ServerParameters{
		MaxConnectionIdle:     15 * time.Second,
		MaxConnectionAge:      30 * time.Second,
		MaxConnectionAgeGrace: 5 * time.Second,
		Time:                  5 * time.Second,
		Timeout:               time.Second,
	}
	if configuration.ServerParameters.MaxConnectionIdle > 0 {
		sp.MaxConnectionIdle = configuration.ServerParameters.MaxConnectionIdle
	}
	if configuration.ServerParameters.MaxConnectionAge > 0 {
		sp.MaxConnectionAge = configuration.ServerParameters.MaxConnectionAge
	}
	if configuration.ServerParameters.MaxConnectionAgeGrace > 0 {
		sp.MaxConnectionAgeGrace = configuration.ServerParameters.MaxConnectionAgeGrace
	}
	if configuration.ServerParameters.Time > 0 {
		sp.Time = configuration.ServerParameters.Time
	}
	if configuration.ServerParameters.Timeout > 0 {
		sp.Timeout = configuration.ServerParameters.Timeout
	}
	return sp
}
type Parameters map[string]interface{}
type Storage map[string]Parameters