mirror of
				https://github.com/netinvent/npbackup.git
				synced 2025-11-04 10:16:07 +08:00 
			
		
		
		
	Allow setting stdin filename from configuration file
This commit is contained in:
		
							parent
							
								
									e83234e341
								
							
						
					
					
						commit
						062715463f
					
				
					 5 changed files with 20 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -7,7 +7,7 @@ __intname__ = "npbackup.configuration"
 | 
			
		|||
__author__ = "Orsiris de Jong"
 | 
			
		||||
__copyright__ = "Copyright (C) 2022-2024 NetInvent"
 | 
			
		||||
__license__ = "GPL-3.0-only"
 | 
			
		||||
__build__ = "2024090401"
 | 
			
		||||
__build__ = "2024090601"
 | 
			
		||||
__version__ = "npbackup 3.0.0+"
 | 
			
		||||
 | 
			
		||||
MIN_CONF_VERSION = 3.0
 | 
			
		||||
| 
						 | 
				
			
			@ -156,6 +156,7 @@ empty_config_dict = {
 | 
			
		|||
                # Accepted values are None, "folder_list", "files_from_verbatim", "files_from_raw", "stdin_from_command"
 | 
			
		||||
                "source_type": None,
 | 
			
		||||
                "stdin_from_command": None,
 | 
			
		||||
                "stdin_filename": None,
 | 
			
		||||
                "tags": [],
 | 
			
		||||
                "compression": "auto",
 | 
			
		||||
                "use_fs_snapshot": True,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1004,7 +1004,7 @@ class NPBackupRunner:
 | 
			
		|||
        self,
 | 
			
		||||
        force: bool = False,
 | 
			
		||||
        read_from_stdin: bool = False,
 | 
			
		||||
        stdin_filename: str = "stdin.data",
 | 
			
		||||
        stdin_filename: str = None,
 | 
			
		||||
    ) -> bool:
 | 
			
		||||
        """
 | 
			
		||||
        Run backup after checking if no recent backup exists, unless force == True
 | 
			
		||||
| 
						 | 
				
			
			@ -1013,6 +1013,10 @@ class NPBackupRunner:
 | 
			
		|||
        warnings = []
 | 
			
		||||
 | 
			
		||||
        stdin_from_command = self.repo_config.g("backup_opts.stdin_from_command")
 | 
			
		||||
        if not stdin_filename:
 | 
			
		||||
            stdin_filename = self.repo_config.g("backup_opts.stdin_filename")
 | 
			
		||||
            if not stdin_filename:
 | 
			
		||||
                stdin_filename = "stdin.data"
 | 
			
		||||
        source_type = self.repo_config.g("backup_opts.source_type")
 | 
			
		||||
        if source_type in (
 | 
			
		||||
            None,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -878,6 +878,16 @@ def config_gui(full_config: dict, config_file: str):
 | 
			
		|||
                ),
 | 
			
		||||
                sg.Input(key="backup_opts.stdin_from_command", size=(100, 1)),
 | 
			
		||||
            ],
 | 
			
		||||
            [sg.Text(_t("config_gui.stdin_filename"))],
 | 
			
		||||
            [
 | 
			
		||||
                sg.Image(
 | 
			
		||||
                    NON_INHERITED_ICON,
 | 
			
		||||
                    key="inherited.backup_opts.stdin_filename",
 | 
			
		||||
                    tooltip=_t("config_gui.group_inherited"),
 | 
			
		||||
                    pad=1,
 | 
			
		||||
                ),
 | 
			
		||||
                sg.Input(key="backup_opts.stdin_filename", size=(100, 1)),
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                sg.Input(visible=False, key="--ADD-PATHS-FILE--", enable_events=True),
 | 
			
		||||
                sg.FilesBrowse(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,6 +109,7 @@ en:
 | 
			
		|||
  files_from_verbatim: From verbatim
 | 
			
		||||
  files_from_raw: From raw
 | 
			
		||||
  stdin_from_command: Standard input from command
 | 
			
		||||
  stdin_filename: Optional filename for stdin backed up data
 | 
			
		||||
 | 
			
		||||
  # retention policiy
 | 
			
		||||
  retention_policy: Retention policy
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,7 +110,8 @@ fr:
 | 
			
		|||
  files_from_verbatim: Liste depuis un fichier "exact"
 | 
			
		||||
  files_from_raw: Liste depuis un fichier "raw"
 | 
			
		||||
  stdin_from_command: Entrée standard depuis une commande
 | 
			
		||||
 | 
			
		||||
  stdin_filename: Nom optionel pour les données sauvegardées depuis l'entrée standard
 | 
			
		||||
  
 | 
			
		||||
  # retention policy
 | 
			
		||||
  retention_policy: Politique de rétention
 | 
			
		||||
  keep: Garder
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue