Updated DNS API Dev Guide (markdown)
parent
eb53f4f8e5
commit
6fb3cbc2a4
|
@ -33,19 +33,9 @@ Here we go:
|
||||||
If you just want to use your script on your machine, you can put it in `.acme.sh/` or `.acme.sh/dnsapi/` folders.
|
If you just want to use your script on your machine, you can put it in `.acme.sh/` or `.acme.sh/dnsapi/` folders.
|
||||||
acme.sh searches the script files in either the acme.sh home dir(`.acme.sh/`) or in the `dnsapi` subfolder(`.acme.sh/dnsapi`).
|
acme.sh searches the script files in either the acme.sh home dir(`.acme.sh/`) or in the `dnsapi` subfolder(`.acme.sh/dnsapi`).
|
||||||
|
|
||||||
### 4. The file shebang must be `sh` not `bash`
|
|
||||||
|
|
||||||
acme.sh is a `unix shell` script, not just a `bash` script.
|
|
||||||
|
|
||||||
If you want to contribute your script, the shebang must be:
|
### 4. There must be 2 functions in your script:
|
||||||
```sh
|
|
||||||
#!/usr/bin/env sh
|
|
||||||
```
|
|
||||||
After the installation, acme.sh could change the shebang to bash to get better performance if you have bash on your machine.
|
|
||||||
|
|
||||||
Of course, if you just use it on your own, it can be any valid shebang on your machine. It could be `sh` or `bash`, it's up to you.
|
|
||||||
|
|
||||||
### 5. There must be 2 functions in your script:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
||||||
|
@ -60,7 +50,7 @@ Here we go:
|
||||||
Actually, the `dns_myapi_add()` is required, but `dns_myapi_rm()` is optional. You can just write the add function at the beginning for testing purpose, it's `highly recommended` to implement the rm function too. Otherwise, your txt records will increase 1 every 2 months.
|
Actually, the `dns_myapi_add()` is required, but `dns_myapi_rm()` is optional. You can just write the add function at the beginning for testing purpose, it's `highly recommended` to implement the rm function too. Otherwise, your txt records will increase 1 every 2 months.
|
||||||
|
|
||||||
|
|
||||||
### 6. Guide for the add function
|
### 5. Guide for the add function
|
||||||
Steps when you write the `dns_myapi_add()` function:
|
Steps when you write the `dns_myapi_add()` function:
|
||||||
#### 1. Get the full domain and the txt record:
|
#### 1. Get the full domain and the txt record:
|
||||||
|
|
||||||
|
@ -257,24 +247,7 @@ Example: https://github.com/Neilpang/acme.sh/issues/2057
|
||||||
Please follow the guide: https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Test
|
Please follow the guide: https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Test
|
||||||
|
|
||||||
|
|
||||||
### 12. Cross-Platform Compatibility Guide
|
|
||||||
|
|
||||||
1. Don't use `grep -o` options, please use `_egrep_o()` function instead, other grep options may be used with caution.
|
See more code of conduct: https://github.com/acmesh-official/acme.sh/wiki/Code-of-conduct
|
||||||
2. Don't use `curl` or `wget`, please use `_get()` or `_post()` function instead. The `_post()` function can send `POST`, `PUT` or `UPDATE` requests.
|
|
||||||
3. Do not use `sed -e`, which causes a problem in OS X and BSD.
|
|
||||||
4. Do not use `sed` with labels, which causes `Label too long` problem in Solaris.
|
|
||||||
5. Do not use `sed` with newlines (`\n`), which causes a problem in OS X and BSD.
|
|
||||||
6. Do not use `grep -E` option.
|
|
||||||
|
|
||||||
|
|
||||||
If you need a BSD or Solaris development environment, please head to [vmactions](https://github.com/vmactions). For example, you can use [solaris-shell](https://github.com/vmactions/shell-solaris) to get a shell environment in Solaris.
|
|
||||||
|
|
||||||
## Style Guidelines
|
|
||||||
acme.sh uses shellcheck for new commits and also enforces style guidelines.
|
|
||||||
To avoid the most common travis failures:
|
|
||||||
|
|
||||||
* Use indentation with 2 spaces
|
|
||||||
* remove trailing spaces
|
|
||||||
* Doublequote variables (use _debug txtvalue "$txtvalue" instead of _debug txtvalue=$txtvalue)
|
|
||||||
* Always check the travis results after a commit
|
|
||||||
* Consider using shellcheck (https://www.shellcheck.net/) before commiting
|
|
Loading…
Reference in New Issue