chore: clean up
This commit is contained in:
@@ -82,10 +82,6 @@ func restoreFromS3(db *dbConfig, conf *RestoreConfig) {
|
|||||||
}
|
}
|
||||||
func restoreFromRemote(db *dbConfig, conf *RestoreConfig) {
|
func restoreFromRemote(db *dbConfig, conf *RestoreConfig) {
|
||||||
utils.Info("Restore database from remote server")
|
utils.Info("Restore database from remote server")
|
||||||
//err := CopyFromRemote(conf.file, conf.remotePath)
|
|
||||||
//if err != nil {
|
|
||||||
// utils.Fatal("Error download file from remote server: %s %v", filepath.Join(conf.remotePath, conf.file), err)
|
|
||||||
//}
|
|
||||||
sshConfig, err := loadSSHConfig()
|
sshConfig, err := loadSSHConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Fatal("Error loading ssh config: %s", err)
|
utils.Fatal("Error loading ssh config: %s", err)
|
||||||
@@ -110,10 +106,6 @@ func restoreFromRemote(db *dbConfig, conf *RestoreConfig) {
|
|||||||
}
|
}
|
||||||
func restoreFromFTP(db *dbConfig, conf *RestoreConfig) {
|
func restoreFromFTP(db *dbConfig, conf *RestoreConfig) {
|
||||||
utils.Info("Restore database from FTP server")
|
utils.Info("Restore database from FTP server")
|
||||||
//err := CopyFromFTP(conf.file, conf.remotePath)
|
|
||||||
//if err != nil {
|
|
||||||
// utils.Fatal("Error download file from FTP server: %s %v", filepath.Join(conf.remotePath, conf.file), err)
|
|
||||||
//}
|
|
||||||
ftpConfig := loadFtpConfig()
|
ftpConfig := loadFtpConfig()
|
||||||
ftpStorage, err := ftp.NewStorage(ftp.Config{
|
ftpStorage, err := ftp.NewStorage(ftp.Config{
|
||||||
Host: ftpConfig.host,
|
Host: ftpConfig.host,
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ type Config struct {
|
|||||||
Region string
|
Region string
|
||||||
DisableSsl bool
|
DisableSsl bool
|
||||||
ForcePathStyle bool
|
ForcePathStyle bool
|
||||||
LocalPath string
|
LocalPath string
|
||||||
RemotePath string
|
RemotePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateSession creates a new AWS session
|
// CreateSession creates a new AWS session
|
||||||
@@ -55,7 +55,7 @@ func NewStorage(conf Config) (storage.Storage, error) {
|
|||||||
bucket: conf.Bucket,
|
bucket: conf.Bucket,
|
||||||
Backend: &storage.Backend{
|
Backend: &storage.Backend{
|
||||||
RemotePath: conf.RemotePath,
|
RemotePath: conf.RemotePath,
|
||||||
LocalPath: conf.LocalPath,
|
LocalPath: conf.LocalPath,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,6 @@ func (s s3Storage) Copy(fileName string) error {
|
|||||||
|
|
||||||
// CopyFrom copies a file from the remote server to local storage
|
// CopyFrom copies a file from the remote server to local storage
|
||||||
func (s s3Storage) CopyFrom(fileName string) error {
|
func (s s3Storage) CopyFrom(fileName string) error {
|
||||||
utils.Info("Copy data from S3 storage...")
|
|
||||||
file, err := os.Create(filepath.Join(s.LocalPath, fileName))
|
file, err := os.Create(filepath.Join(s.LocalPath, fileName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user