@@ -226,10 +226,11 @@ func (c *Config) applyEnv() (func() error, error) {
226226 return unset , nil
227227}
228228
229- func (c * Config ) resolve () (func () error , error ) {
229+ func (c * Config ) resolve () (func () error , []string , error ) {
230+ warnings := []string {}
230231 resetEnv , err := c .applyEnv ()
231232 if err != nil {
232- return resetEnv , errwrap .Wrap (err , "error applying env" )
233+ return resetEnv , warnings , errwrap .Wrap (err , "error applying env" )
233234 }
234235
235236 if c .BackupFilenameExpand {
@@ -238,5 +239,40 @@ func (c *Config) resolve() (func() error, error) {
238239 c .BackupPruningPrefix = os .ExpandEnv (c .BackupPruningPrefix )
239240 }
240241
241- return resetEnv , nil
242+ if c .EmailNotificationRecipient != "" {
243+ emailURL := fmt .Sprintf (
244+ "smtp://%s:%s@%s:%d/?from=%s&to=%s" ,
245+ c .EmailSMTPUsername ,
246+ c .EmailSMTPPassword ,
247+ c .EmailSMTPHost ,
248+ c .EmailSMTPPort ,
249+ c .EmailNotificationSender ,
250+ c .EmailNotificationRecipient ,
251+ )
252+ c .NotificationURLs = append (c .NotificationURLs , emailURL )
253+ warnings = append (warnings ,
254+ "Using EMAIL_* keys for providing notification configuration has been deprecated and will be removed in the next major version." ,
255+ "Please use NOTIFICATION_URLS instead. Refer to the README for an upgrade guide." ,
256+ )
257+ }
258+
259+ if c .BackupFromSnapshot {
260+ warnings = append (warnings ,
261+ "Using BACKUP_FROM_SNAPSHOT has been deprecated and will be removed in the next major version." ,
262+ "Please use `archive-pre` and `archive-post` commands to prepare your backup sources. Refer to the documentation for an upgrade guide." ,
263+ )
264+ }
265+
266+ if c .BackupStopDuringBackupLabel != "" && c .BackupStopContainerLabel != "" {
267+ return resetEnv , warnings , errwrap .Wrap (nil , "both BACKUP_STOP_DURING_BACKUP_LABEL and BACKUP_STOP_CONTAINER_LABEL have been set, cannot continue" )
268+ }
269+ if c .BackupStopContainerLabel != "" {
270+ warnings = append (warnings ,
271+ "Using BACKUP_STOP_CONTAINER_LABEL has been deprecated and will be removed in the next major version." ,
272+ "Please use BACKUP_STOP_DURING_BACKUP_LABEL instead. Refer to the docs for an upgrade guide." ,
273+ )
274+ c .BackupStopDuringBackupLabel = c .BackupStopContainerLabel
275+ }
276+
277+ return resetEnv , warnings , nil
242278}
0 commit comments