func NewReqBackupConfig() *Config {
	replicaStr := getEnvValue("REPLICAS")
	replicas, err := strconv.ParseInt(replicaStr, 10, 32)
	if err != nil {
		log.Error(err, "invalid environment values", "REPLICAS", replicaStr)
		panic(err)
	}
	return &Config{
		NameSpace:   getEnvValue("NAMESPACE"),
		ServiceName: getEnvValue("SERVICE_NAME"),
		Replicas:    int32(replicas),
		BackupUser:     getEnvValue("BACKUP_USER"),
		BackupPassword: getEnvValue("BACKUP_PASSWORD"),
	}
}
NewReqBackupConfig returns the configuration file needed for backup job.
package sidecar
import (
	"fmt"
	"os"
	"strconv"
	"text/template"
	"github.com/blang/semver"
	"github.com/go-ini/ini"
	"github.com/radondb/radondb-mysql-kubernetes/utils"
)
type Config struct {
	HostName string
	NameSpace string
	ServiceName string
	StatefulSetName string
	Replicas int32
	RootPassword string
	User string
	Password string
	Database string
	ReplicationUser string
	ReplicationPassword string
	MetricsUser string
	MetricsPassword string
	OperatorUser string
	OperatorPassword string
	InternalRootPassword string
	InitTokuDB bool
	MySQLVersion semver.Version
	AdmitDefeatHearbeatCount int32
	ElectionTimeout int32
	existMySQLData bool
	ClusterName string
	BackupUser string
	BackupPassword string
	XbstreamExtraArgs []string
	XtrabackupExtraArgs []string
	XtrabackupPrepareExtraArgs []string
	XtrabackupTargetDir string
	XCloudS3EndPoint string
	XCloudS3AccessKey string
	XCloudS3SecretKey string
	XCloudS3Bucket string
	XRestoreFrom string
}
func NewInitConfig() *Config {
	mysqlVersion, err := semver.Parse(getEnvValue("MYSQL_VERSION"))
	if err != nil {
		log.Info("MYSQL_VERSION is not a semver version")
		mysqlVersion, _ = semver.Parse(utils.MySQLDefaultVersion)
	}
	replicaStr := getEnvValue("REPLICAS")
	replicas, err := strconv.ParseInt(replicaStr, 10, 32)
	if err != nil {
		log.Error(err, "invalid environment values", "REPLICAS", replicaStr)
		panic(err)
	}
	initTokuDB := false
	if len(getEnvValue("INIT_TOKUDB")) > 0 {
		initTokuDB = true
	}
	admitDefeatHearbeatCount, err := strconv.ParseInt(getEnvValue("ADMIT_DEFEAT_HEARBEAT_COUNT"), 10, 32)
	if err != nil {
		admitDefeatHearbeatCount = 5
	}
	electionTimeout, err := strconv.ParseInt(getEnvValue("ELECTION_TIMEOUT"), 10, 32)
	if err != nil {
		electionTimeout = 10000
	}
	existMySQLData, _ := checkIfPathExists(fmt.Sprintf("%s/mysql", dataPath))
	return &Config{
		HostName:        getEnvValue("POD_HOSTNAME"),
		NameSpace:       getEnvValue("NAMESPACE"),
		ServiceName:     getEnvValue("SERVICE_NAME"),
		StatefulSetName: getEnvValue("STATEFULSET_NAME"),
		Replicas:        int32(replicas),
		RootPassword:         getEnvValue("MYSQL_ROOT_PASSWORD"),
		InternalRootPassword: getEnvValue("INTERNAL_ROOT_PASSWORD"),
		Database: getEnvValue("MYSQL_DATABASE"),
		User:     getEnvValue("MYSQL_USER"),
		Password: getEnvValue("MYSQL_PASSWORD"),
		ReplicationUser:     getEnvValue("MYSQL_REPL_USER"),
		ReplicationPassword: getEnvValue("MYSQL_REPL_PASSWORD"),
		MetricsUser:     getEnvValue("METRICS_USER"),
		MetricsPassword: getEnvValue("METRICS_PASSWORD"),
		OperatorUser:     getEnvValue("OPERATOR_USER"),
		OperatorPassword: getEnvValue("OPERATOR_PASSWORD"),
		InitTokuDB: initTokuDB,
		MySQLVersion: mysqlVersion,
		AdmitDefeatHearbeatCount: int32(admitDefeatHearbeatCount),
		ElectionTimeout:          int32(electionTimeout),
		existMySQLData:    existMySQLData,
		XRestoreFrom:      getEnvValue("RESTORE_FROM"),
		XCloudS3EndPoint:  getEnvValue("S3_ENDPOINT"),
		XCloudS3AccessKey: getEnvValue("S3_ACCESSKEY"),
		XCloudS3SecretKey: getEnvValue("S3_SECRETKEY"),
		XCloudS3Bucket:    getEnvValue("S3_BUCKET"),
	}
}
func NewBackupConfig() *Config {
	replicaStr := getEnvValue("REPLICAS")
	replicas, err := strconv.ParseInt(replicaStr, 10, 32)
	if err != nil {
		log.Error(err, "invalid environment values", "REPLICAS", replicaStr)
		panic(err)
	}
	return &Config{
		NameSpace:    getEnvValue("NAMESPACE"),
		ServiceName:  getEnvValue("SERVICE_NAME"),
		Replicas:     int32(replicas),
		ClusterName:  getEnvValue("SERVICE_NAME"),
		RootPassword: getEnvValue("MYSQL_ROOT_PASSWORD"),
		BackupUser:     getEnvValue("BACKUP_USER"),
		BackupPassword: getEnvValue("BACKUP_PASSWORD"),
		XCloudS3EndPoint:  getEnvValue("S3_ENDPOINT"),
		XCloudS3AccessKey: getEnvValue("S3_ACCESSKEY"),
		XCloudS3SecretKey: getEnvValue("S3_SECRETKEY"),
		XCloudS3Bucket:    getEnvValue("S3_BUCKET"),
	}
}