Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
35ea0c8d
Commit
35ea0c8d
authored
Jan 31, 2016
by
Neil
Browse files
Merge pull request #51 from Neilpang/dnsapi
support account config file to save dns api key
parents
1e867b3b
b25d22b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns-cf.sh
View file @
35ea0c8d
...
...
@@ -22,6 +22,10 @@ dns-cf-add() {
return
1
fi
#save the api key and email to the account conf file.
_saveaccountconf CF_Key
"
$CF_Key
"
_saveaccountconf CF_Email
"
$CF_Email
"
_debug
"First detect the root zone"
if
!
_get_root
$fulldomain
;
then
_err
"invalid domain"
...
...
le.sh
View file @
35ea0c8d
#!/bin/bash
VER
=
1.1.
2
VER
=
1.1.
3
PROJECT
=
"https://github.com/Neilpang/le"
DEFAULT_CA
=
"https://acme-v01.api.letsencrypt.org"
...
...
@@ -242,6 +242,29 @@ _setopt() {
_debug
"
$(
grep
-H
-n
"^
$__opt$__sep
"
$__conf
)
"
}
#_savedomainconf key value
#save to domain.conf
_savedomainconf
()
{
key
=
"
$1
"
value
=
"
$2
"
if
[
"
$DOMAIN_CONF
"
]
;
then
_setopt
$DOMAIN_CONF
"
$key
"
"="
"
$value
"
else
_debug
"DOMAIN_CONF is empty, can not save
$key
=
$value
"
fi
}
#_saveaccountconf key value
_saveaccountconf
()
{
key
=
"
$1
"
value
=
"
$2
"
if
[
"
$ACCOUNT_CONF_PATH
"
]
;
then
_setopt
$ACCOUNT_CONF_PATH
"
$key
"
"="
"
$value
"
else
_debug
"ACCOUNT_CONF_PATH is empty, can not save
$key
=
$value
"
fi
}
_startserver
()
{
content
=
"
$1
"
_NC
=
"nc -q 1"
...
...
@@ -296,7 +319,15 @@ _initpath() {
mkdir
-p
"
$WORKING_DIR
"
if
[
-z
"
$ACCOUNT_KEY_PATH
"
]
;
then
ACCOUNT_KEY_PATH
=
"
$WORKING_DIR
/account.acc"
ACCOUNT_KEY_PATH
=
"
$WORKING_DIR
/account.key"
fi
if
[
-z
"
$ACCOUNT_CONF_PATH
"
]
;
then
ACCOUNT_CONF_PATH
=
"
$WORKING_DIR
/account.conf"
fi
if
[
-f
"
$ACCOUNT_CONF_PATH
"
]
;
then
source
"
$ACCOUNT_CONF_PATH
"
fi
if
[
-z
"
$domain
"
]
;
then
...
...
@@ -1040,6 +1071,11 @@ install() {
mkdir
-p
$WORKING_DIR
/dnsapi
cp
dnsapi/
*
$WORKING_DIR
/dnsapi/
#to keep compatible mv the .acc file to .key file
if
[
-f
"
$WORKING_DIR
/account.acc"
]
;
then
mv
"
$WORKING_DIR
/account.acc"
"
$WORKING_DIR
/account.key"
fi
installcronjob
_info OK
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment