Pārlūkot izejas kodu

Fix broken pass-through of BORG_* environment variables to Borg (#327).

Reviewed-on: https://projects.torsion.org/witten/borgmatic/pulls/327
Dan Helfman 5 gadi atpakaļ
vecāks
revīzija
c8d5de2179
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      borgmatic/borg/environment.py

+ 2 - 1
borgmatic/borg/environment.py

@@ -19,7 +19,8 @@ DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE = {
 
 
 def initialize(storage_config):
 def initialize(storage_config):
     for option_name, environment_variable_name in OPTION_TO_ENVIRONMENT_VARIABLE.items():
     for option_name, environment_variable_name in OPTION_TO_ENVIRONMENT_VARIABLE.items():
-        value = storage_config.get(option_name)
+        # Options from the config.yaml file have precedence over already set env variables:
+        value = storage_config.get(option_name) or os.environ.get(environment_variable_name)
         if value:
         if value:
             os.environ[environment_variable_name] = value
             os.environ[environment_variable_name] = value
         else:
         else: