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
c0449a3e
Commit
c0449a3e
authored
Oct 25, 2019
by
Jesai Langenbach
Browse files
Only save Attributes if it is set
parent
bfa6e524
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_opnsense.sh
View file @
c0449a3e
...
@@ -220,22 +220,32 @@ _opns_check_auth() {
...
@@ -220,22 +220,32 @@ _opns_check_auth() {
if
[
-z
"
$OPNs_Host
"
]
;
then
if
[
-z
"
$OPNs_Host
"
]
;
then
OPNs_Host
=
"localhost"
OPNs_Host
=
"localhost"
_err
"You don't specify OPNsense address."
_err
"You don't specify OPNsense address."
return
1
else
_saveaccountconf_mutable OPNs_Host
"
$OPNs_Host
"
fi
fi
if
[
-z
"
$OPNs_Port
"
]
;
then
if
[
-z
"
$OPNs_Port
"
]
;
then
OPNs_Port
=
"443"
OPNs_Port
=
"443"
_err
"You don't specify OPNsense Port."
else
_saveaccountconf_mutable OPNs_Port
"
$OPNs_Port
"
fi
fi
if
[
-z
"
$OPNs_Api_Insecure
"
]
;
then
if
[
-z
"
$OPNs_Api_Insecure
"
]
;
then
OPNs_Api_Insecure
=
"0"
OPNs_Api_Insecure
=
"0"
else
#save the api addr and key to the account conf file.
_saveaccountconf_mutable OPNs_Api_Insecure
"
$OPNs_Api_Insecure
"
fi
fi
export
HTTPS_INSECURE
=
"
${
OPNs_Api_Insecure
}
"
if
[
-z
"
$OPNs_Key
"
]
;
then
if
[
-z
"
$OPNs_Key
"
]
;
then
OPNs_Key
=
""
OPNs_Key
=
""
_err
"You don't specify OPNsense api key id."
_err
"You don't specify OPNsense api key id."
_err
"Please set you OPNs_Key and try again."
_err
"Please set you OPNs_Key and try again."
return
1
return
1
else
_saveaccountconf_mutable OPNs_Key
"
$OPNs_Key
"
fi
fi
if
[
-z
"
$OPNs_Token
"
]
;
then
if
[
-z
"
$OPNs_Token
"
]
;
then
...
@@ -243,15 +253,10 @@ _opns_check_auth() {
...
@@ -243,15 +253,10 @@ _opns_check_auth() {
_err
"You don't specify OPNsense token."
_err
"You don't specify OPNsense token."
_err
"Please create you OPNs_Token and try again."
_err
"Please create you OPNs_Token and try again."
return
1
return
1
else
_saveaccountconf_mutable OPNs_Token
"
$OPNs_Token
"
fi
fi
#save the api addr and key to the account conf file.
_saveaccountconf_mutable OPNs_Host
"
$OPNs_Host
"
_saveaccountconf_mutable OPNs_Port
"
$OPNs_Port
"
_saveaccountconf_mutable OPNs_Key
"
$OPNs_Key
"
_saveaccountconf_mutable OPNs_Token
"
$OPNs_Token
"
_saveaccountconf_mutable OPNs_Api_Insecure
"
$OPNs_Api_Insecure
"
export
HTTPS_INSECURE
=
"
${
OPNs_Api_Insecure
}
"
if
!
_opns_rest
"GET"
"/general/get"
;
then
if
!
_opns_rest
"GET"
"/general/get"
;
then
_err
"Can't Access OPNsense"
_err
"Can't Access OPNsense"
...
...
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