Skip to content

Commit

Permalink
doc(readme): update config
Browse files Browse the repository at this point in the history
  • Loading branch information
NewFuture committed Jun 14, 2021
1 parent 3eae884 commit 9e54d4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@

## 详细配置

所有字段可通过三种方式进行配置

1. 命令行参数 `ddns --key=value` (`ddns -h` 查看详情),优先级最高
2. JSON配置文件(值为null认为是有效值,会覆盖环境变量的设置,如果没有对应的key则会尝试试用环境变量)
3. 环境变量DDNS_前缀加上key 全大写或者全小写 (`${ddns_key}``${DDNS_KEY}`)

<details open>

<summary markdown="span">config.json 配置文件
Expand Down
4 changes: 2 additions & 2 deletions util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def init_config(description, doc, version):

__cli_args = parser.parse_args()
is_configfile_optional = get_config("token") or get_config("id")
config_file = get_config("config");
config_file = get_config("config")
if not is_configfile_optional or config_file is not None:
__load_config(config_file or "config.json", is_configfile_optional)
__load_config(config_file or "config.json", is_configfile_optional)
__cli_args.config = config_file or "config.json"


Expand Down

0 comments on commit 9e54d4c

Please sign in to comment.