feat: 增加对环境变量的判断
This commit is contained in:
@@ -29,11 +29,10 @@ class Config:
|
|||||||
self.check_config()
|
self.check_config()
|
||||||
|
|
||||||
def get_temp_mail(self):
|
def get_temp_mail(self):
|
||||||
logging.info(f"\033[32m临时邮箱: {self.temp_mail}\033[0m")
|
|
||||||
return self.temp_mail
|
return self.temp_mail
|
||||||
|
|
||||||
def get_domain(self):
|
def get_domain(self):
|
||||||
logging.info(f"\033[32m域名: {self.domain}\033[0m")
|
|
||||||
return self.domain
|
return self.domain
|
||||||
|
|
||||||
def check_config(self):
|
def check_config(self):
|
||||||
@@ -42,6 +41,9 @@ class Config:
|
|||||||
if not self.check_is_valid(self.domain):
|
if not self.check_is_valid(self.domain):
|
||||||
raise ValueError("域名未配置,请在 .env 文件中设置 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):
|
def check_is_valid(self, str):
|
||||||
return len(str.strip()) > 0
|
return len(str.strip()) > 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user