mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2025-12-06 13:39:41 +01:00
refactor: refactoring of code, update docs
This commit is contained in:
@@ -39,7 +39,7 @@ func RestoreDatabase(file string) {
|
||||
dbPort = os.Getenv("DB_PORT")
|
||||
storagePath = os.Getenv("STORAGE_PATH")
|
||||
if file == "" {
|
||||
utils.Fatal("Error required --file")
|
||||
utils.Fatal("Error, file required")
|
||||
}
|
||||
|
||||
if os.Getenv("DB_HOST") == "" || os.Getenv("DB_NAME") == "" || os.Getenv("DB_USERNAME") == "" || os.Getenv("DB_PASSWORD") == "" || file == "" {
|
||||
|
||||
@@ -26,11 +26,14 @@ func S3Mount() {
|
||||
func MountS3Storage(s3Path string) {
|
||||
accessKey = os.Getenv("ACCESS_KEY")
|
||||
secretKey = os.Getenv("SECRET_KEY")
|
||||
bucketName = os.Getenv("BUCKETNAME")
|
||||
bucketName = os.Getenv("BUCKET_NAME")
|
||||
if bucketName == "" {
|
||||
bucketName = os.Getenv("BUCKETNAME")
|
||||
}
|
||||
s3Endpoint = os.Getenv("S3_ENDPOINT")
|
||||
|
||||
if accessKey == "" || secretKey == "" || bucketName == "" {
|
||||
utils.Fatal("Please make sure all environment variables are set")
|
||||
utils.Fatal("Please make sure all environment variables are set for S3")
|
||||
} else {
|
||||
storagePath := fmt.Sprintf("%s%s", s3MountPath, s3Path)
|
||||
err := os.Setenv("STORAGE_PATH", storagePath)
|
||||
|
||||
Reference in New Issue
Block a user