@@ -135,6 +135,7 @@ static void opt_backup_mode(ConfigOption *opt, const char *arg);
135
135
static void opt_show_format (ConfigOption * opt , const char * arg );
136
136
137
137
static void compress_init (void );
138
+ static void encryption_init (void );
138
139
139
140
/*
140
141
* Short name should be non-printable ASCII character.
@@ -600,9 +601,8 @@ main(int argc, char *argv[])
600
601
if (num_threads < 1 )
601
602
num_threads = 1 ;
602
603
604
+ encryption_init ();
603
605
compress_init ();
604
- if (instance_config .encryption )
605
- fio_crypto_init ();
606
606
607
607
/* do actual operation */
608
608
switch (backup_subcmd )
@@ -714,6 +714,23 @@ opt_show_format(ConfigOption *opt, const char *arg)
714
714
elog (ERROR , "Invalid show format \"%s\"" , arg );
715
715
}
716
716
717
+ /*
718
+ * Initialize encryption support.
719
+ */
720
+ static void encryption_init (void )
721
+ {
722
+ if (encryption_shortcut )
723
+ instance_config .encryption = encryption_shortcut ;
724
+
725
+ if (instance_config .encryption )
726
+ {
727
+ if (!instance_config .remote .host )
728
+ elog (ERROR , "Encryp;tion is upported only for remote backups" );
729
+
730
+ fio_crypto_init ();
731
+ }
732
+ }
733
+
717
734
/*
718
735
* Initialize compress and sanity checks for compress.
719
736
*/
@@ -724,9 +741,6 @@ compress_init(void)
724
741
if (compress_shortcut )
725
742
instance_config .compress_alg = ZLIB_COMPRESS ;
726
743
727
- if (encryption_shortcut )
728
- instance_config .encryption = encryption_shortcut ;
729
-
730
744
if (backup_subcmd != SET_CONFIG_CMD )
731
745
{
732
746
if (instance_config .compress_level != COMPRESS_LEVEL_DEFAULT
0 commit comments