mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ feat(config): 修改错误提示信息,更新基础配置文件名称为.env.example
This commit is contained in:
parent
6c136b904d
commit
c9456f292d
@ -40,7 +40,7 @@ async def _(setting: Setting) -> Result:
|
||||
return Result.fail("配置已存在,请先删除DB_URL内容和前端密码再进行设置。")
|
||||
env_file = Path() / ".env.example"
|
||||
if not env_file.exists():
|
||||
return Result.fail("配置文件.env.dev不存在。")
|
||||
return Result.fail("基础配置文件.env.example不存在。")
|
||||
env_text = env_file.read_text(encoding="utf-8")
|
||||
to_env_file = Path() / ".env.dev"
|
||||
if setting.db_url:
|
||||
|
||||
@ -287,15 +287,37 @@ class BaseRepoManager(ABC):
|
||||
"rev-parse --is-inside-work-tree", cwd=local_path
|
||||
)
|
||||
if not success:
|
||||
# 如果不是Git仓库,尝试初始化它
|
||||
logger.info(f"目录 {local_path} 不是Git仓库,尝试初始化", LOG_COMMAND)
|
||||
init_success, _, init_stderr = await run_git_command(
|
||||
"init", cwd=local_path
|
||||
)
|
||||
if not init_success:
|
||||
return RepoUpdateResult(
|
||||
repo_type=repo_type or RepoType.GITHUB,
|
||||
repo_name=repo_name,
|
||||
owner=owner or "",
|
||||
old_version="",
|
||||
new_version="",
|
||||
error_message=f"{local_path} 不是一个Git仓库",
|
||||
error_message=f"初始化Git仓库失败: {init_stderr}",
|
||||
)
|
||||
|
||||
# 添加远程仓库
|
||||
remote_success, _, remote_stderr = await run_git_command(
|
||||
f"remote add origin {repo_url}", cwd=local_path
|
||||
)
|
||||
if not remote_success:
|
||||
return RepoUpdateResult(
|
||||
repo_type=repo_type or RepoType.GITHUB,
|
||||
repo_name=repo_name,
|
||||
owner=owner or "",
|
||||
old_version="",
|
||||
new_version="",
|
||||
error_message=f"添加远程仓库失败: {remote_stderr}",
|
||||
)
|
||||
|
||||
logger.info(f"成功初始化Git仓库 {local_path}", LOG_COMMAND)
|
||||
|
||||
# 获取当前提交ID作为旧版本
|
||||
success, old_version, _ = await run_git_command(
|
||||
"rev-parse HEAD", cwd=local_path
|
||||
|
||||
Loading…
Reference in New Issue
Block a user