feat: 增加对环境变量的判断

This commit is contained in:
chengchongzhen
2025-01-13 13:31:39 +08:00
parent fa313d699a
commit 7ce80bd2b2

View File

@@ -29,11 +29,10 @@ class Config:
self.check_config()
def get_temp_mail(self):
logging.info(f"\033[32m临时邮箱: {self.temp_mail}\033[0m")
return self.temp_mail
def get_domain(self):
logging.info(f"\033[32m域名: {self.domain}\033[0m")
return self.domain
def check_config(self):
@@ -42,6 +41,9 @@ class Config:
if not self.check_is_valid(self.domain):
raise ValueError("域名未配置,请在 .env 文件中设置 DOMAIN")
logging.info(f"\033[32m临时邮箱: {self.temp_mail}\033[0m")
logging.info(f"\033[32m域名: {self.domain}\033[0m")
def check_is_valid(self, str):
return len(str.strip()) > 0