Browse Source

auto generate configuration file

New Future 7 years ago
parent
commit
7626f6ca7e
3 changed files with 11 additions and 25 deletions
  1. 6 5
      README.md
  2. 0 17
      example.config.json
  3. 5 3
      run.py

+ 6 - 5
README.md

@@ -36,7 +36,7 @@ DDNS
 
 ### 1.下载
 
-* 二进制版(无需python环境,preview)
+* 单文件版(二进制编译,无需python环境,preview)
 	* Windows [ddns.exe](https://github.com/NewFuture/DDNS/releases/)
 	* Linux (仅Ubuntu测试) [ddns](https://github.com/NewFuture/DDNS/releases/)
 * 源码运行(需要python环境)
@@ -47,14 +47,14 @@ DDNS
 ### 2.快速配置
 
 1. 复制 `example.config.json`到`config.json`
-2. 申请 api token:
+2. 申请 api `token`:
 	* [DNSPOD(国内版)创建token](https://support.dnspod.cn/Kb/showarticle/tsid/227/)
 	* [阿里云accesskey](https://help.aliyun.com/knowledge_detail/38738.html)
 	* [DNS.COM API Key/Secret](https://www.dns.com/member/apiSet)
 	* [DNSPOD(国际版)](https://www.dnspod.com/docs/info.html#get-the-user-token)
 	* [CloudFlare](https://support.cloudflare.com/hc/en-us/articles/200167836-Where-do-I-find-my-Cloudflare-API-key-)
 
-3. 修改配置,`ipv4`和`ipv6`字段,无则设为`[]`,详细参照配置说明
+3. 修改配置,`ipv4`和`ipv6`字段,无则设为`[]`(此时不会解析和更新对应IP),详细参照配置说明
 
 
 ## 配置
@@ -64,7 +64,8 @@ DDNS
 <summary>config.json
 </summary>
 
-可以使用 `-c`使用指定的配置文件 (默认读取当前目录的 config.json)
+* 首次运行会自动生成一个模板配置文件
+* 可以使用 `-c`使用指定的配置文件 (默认读取当前目录的 config.json)
 
 ```bash
 python run.py -c /path/to/config.json 
@@ -119,7 +120,7 @@ python run.py -c /path/to/config.json
 </details>
 
 
-## 定时任务 (暂时需要源码)
+## 定时任务
 
 <details>
 

+ 0 - 17
example.config.json

@@ -1,17 +0,0 @@
-{
-	"id": "your id",
-	"token": "your token",
-	"dns": "dnspod",
-	"ipv4": [
-		"your.domain",
-		"ipv4.yours.domain"
-	],
-	"ipv6": [
-		"your.domain",		
-		"ipv6.your.domain"
-	],
-	"index4": "default",
-	"index6": "default",
-	"proxy": null,
-	"debug": null
-}

+ 5 - 3
run.py

@@ -37,15 +37,17 @@ def get_config(key=None, default=None, path="config.json"):
                     "dns": "dnspod",
                     "ipv4": [
                         "your.domain",
-                        "ipv4.yours.domain"
+                        "server.your.domain"
                     ],
                     "ipv6": [
                         "your.domain",
-                        "ipv6.your.domain"
+                        "server.your.domain",
+                        "ipv6.server.your.domain"
                     ],
                     "index4": "default",
                     "index6": "default",
-                    "proxy": None
+                    "proxy": None,
+                    "debug": False,
                 }
                 json.dump(configure, configfile, indent=2, sort_keys=True)
             sys.exit("New template configure file is created!")