refactor: replace function params by config struct

This commit is contained in:
Jonas Kaninda
2024-09-29 20:08:36 +02:00
parent 247e90f73e
commit 76bbfa35c4
2 changed files with 9 additions and 10 deletions

View File

@@ -37,7 +37,7 @@ type BackupConfig struct {
prune bool
encryption bool
remotePath string
gpqPassphrase string
passphrase string
storage string
cronExpression string
}
@@ -79,11 +79,11 @@ func initBackupConfig(cmd *cobra.Command) *BackupConfig {
prune, _ := cmd.Flags().GetBool("prune")
disableCompression, _ = cmd.Flags().GetBool("disable-compression")
_, _ = cmd.Flags().GetString("mode")
gpqPassphrase := os.Getenv("GPG_PASSPHRASE")
passphrase := os.Getenv("GPG_PASSPHRASE")
_ = utils.GetEnv(cmd, "path", "AWS_S3_PATH")
cronExpression := os.Getenv("BACKUP_CRON_EXPRESSION")
if gpqPassphrase != "" {
if passphrase != "" {
encryption = true
}
//Initialize backup configs
@@ -94,7 +94,7 @@ func initBackupConfig(cmd *cobra.Command) *BackupConfig {
config.storage = storage
config.encryption = encryption
config.remotePath = remotePath
config.gpqPassphrase = gpqPassphrase
config.passphrase = passphrase
config.cronExpression = cronExpression
return &config
}