refactor: refactoring of code

This commit is contained in:
2024-01-19 06:49:29 +01:00
parent b19e97064a
commit d148e26aee
4 changed files with 10 additions and 12 deletions

View File

@@ -22,8 +22,8 @@ var (
storagePath = "/backup"
)
// Backup backup database
func Backup(disableCompression bool) {
// BackupDatabase backup database
func BackupDatabase(disableCompression bool) {
dbHost = os.Getenv("DB_HOST")
dbPassword = os.Getenv("DB_PASSWORD")
dbUserName = os.Getenv("DB_USERNAME")

View File

@@ -8,8 +8,8 @@ import (
"path/filepath"
)
// Restore restore database
func Restore(file string) {
// RestoreDatabase restore database
func RestoreDatabase(file string) {
dbHost = os.Getenv("DB_HOST")
dbPassword = os.Getenv("DB_PASSWORD")
dbUserName = os.Getenv("DB_USERNAME")

View File

@@ -21,15 +21,13 @@ var (
s3Endpoint = ""
)
func init() {
// MountS3Storage Mount s3 storage using s3fs
func MountS3Storage(s3Path string) {
accessKey = os.Getenv("ACCESS_KEY")
secretKey = os.Getenv("SECRET_KEY")
bucketName = os.Getenv("BUCKETNAME")
s3Endpoint = os.Getenv("S3_ENDPOINT")
}
// MountS3Storage Mount s3 storage using s3fs
func MountS3Storage(s3Path string) {
if accessKey == "" || secretKey == "" || bucketName == "" {
utils.Fatal("Please make sure all environment variables are set")
} else {