Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] 添加参数 dailycheckin --config [config.json路径] #355

Closed
yzqdev opened this issue Apr 26, 2024 · 2 comments
Closed

[Request] 添加参数 dailycheckin --config [config.json路径] #355

yzqdev opened this issue Apr 26, 2024 · 2 comments

Comments

@yzqdev
Copy link

yzqdev commented Apr 26, 2024

🥰 需求描述

看了一下源码,是从这几个位置获取config.json的

for one_path in [
"/ql/scripts/config.json",
"config.json",
"../config.json",
"./config/config.json",
"../config/config.json",
"/config.json",
]:
_config_path = os.path.join(os.getcwd(), one_path)

可以添加一个可选的--config [config.json路径]参数,如果参数存在,就优先使用参数的config.json路径

#349, #286

手动部署的时候可以直接指定config.json路径,避免部分命令比如crontab执行dailycheckin命令的pwd不对,导致程序找不到config.json

🧐 解决方案

parser = argparse.ArgumentParser()
parser.add_argument("--include", nargs="+", help="任务执行包含的任务列表")
parser.add_argument("--exclude", nargs="+", help="任务执行排除的任务列表")
return parser.parse_args()

添加

 parser.add_argument("--config", nargs="+", help="config.json绝对路径") 

📝 补充信息

No response

@ximu-tao
Copy link

ximu-tao commented May 7, 2024

我也遇到了类似的问题,我目前的解决方法是在自己的脚本文件中import dailycheckin
像这样:

import os
import dailycheckin.main as dailycheckin
os.chdir("config.json所在的路径")
dailycheckin.checkin()

@Sitoi
Copy link
Owner

Sitoi commented May 22, 2024

归档到 projects 中 https://github.com/users/Sitoi/projects/1 关闭 issue

@Sitoi Sitoi closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants