diff options
| author | crupest <crupest@outlook.com> | 2022-11-23 14:17:16 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2022-11-23 14:17:16 +0800 | 
| commit | 6272b219ba4fb29dd542d10cb846a0dbb6edf4ea (patch) | |
| tree | 5096701ba667057049597ca8f913ee91aaa1e009 /tool/aio.py | |
| parent | 647bebc5cc01ab6e1714885563d8b09e2ed51a24 (diff) | |
| download | crupest-6272b219ba4fb29dd542d10cb846a0dbb6edf4ea.tar.gz crupest-6272b219ba4fb29dd542d10cb846a0dbb6edf4ea.tar.bz2 crupest-6272b219ba4fb29dd542d10cb846a0dbb6edf4ea.zip  | |
Add backup.
Diffstat (limited to 'tool/aio.py')
| -rwxr-xr-x | tool/aio.py | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/tool/aio.py b/tool/aio.py index cdb616c..703b4f2 100755 --- a/tool/aio.py +++ b/tool/aio.py @@ -240,7 +240,7 @@ for filename in template_name_list:  class ConfigVar: -    def __init__(self, name: str, description: str, default_value_generator): +    def __init__(self, name: str, description: str, default_value_generator, /, default_value_for_ask=None):          """Create a config var.          Args: @@ -251,10 +251,11 @@ class ConfigVar:          self.name = name          self.description = description          self.default_value_generator = default_value_generator +        self.default_value_for_ask = default_value_for_ask      def get_default_value(self):          if isinstance(self.default_value_generator, str): -            return Prompt.ask(self.default_value_generator, console=console) +            return Prompt.ask(self.default_value_generator, console=console, default=self.default_value_for_ask)          else:              return self.default_value_generator() @@ -275,7 +276,15 @@ config_var_list: list = [      ConfigVar("CRUPEST_HALO_DB_PASSWORD",                "password for halo h2 database, once used never change it", lambda: os.urandom(8).hex()),      ConfigVar("CRUPEST_IN_CHINA", -              "set to true if you are in China, some network optimization will be applied", lambda: "false") +              "set to true if you are in China, some network optimization will be applied", lambda: "false"), +    ConfigVar("CRUPEST_AUTO_BACKUP_COS_ACCESS_KEY_ID", +              "access key id for Tencent COS, used for auto backup", "Please input your Tencent COS access key id for backup:"), +    ConfigVar("CRUPEST_AUTO_BACKUP_COS_SECRET_ACCESS_KEY", +              "access key secret for Tencent COS, used for auto backup", "Please input your Tencent COS access key for backup:"), +    ConfigVar("CRUPEST_AUTO_BACKUP_COS_REGION", +              "region for Tencent COS, used for auto backup", "Please input your Tencent COS region for backup:", "ap-hongkong"), +    ConfigVar("CRUPEST_AUTO_BACKUP_BUCKET_NAME", +              "bucket name for Tencent COS, used for auto backup", "Please input your Tencent COS bucket name for backup:")  ]  config_var_name_set = set([config_var.name for config_var in config_var_list])  | 
