turns emv into constant
This commit is contained in:
parent
02236e7450
commit
cf92f8a441
@ -23,6 +23,8 @@ func New(keyLabel, keyAlgorithm, keySecret, server string, port int, zone string
|
||||
}
|
||||
}
|
||||
|
||||
const ENV_PATH string = "/usr/bin/env"
|
||||
|
||||
var (
|
||||
// escape characters
|
||||
specialChars = []string{
|
||||
@ -43,7 +45,7 @@ func (c NsUpdateStruct) UpdateTXT(record, recordType, value string) error {
|
||||
value = sanitizeTXT(value)
|
||||
|
||||
command := fmt.Sprintf("dig +short TXT %s", record)
|
||||
cmd := exec.Command("/usr/bin/env", "sh", "-c", command)
|
||||
cmd := exec.Command(ENV_PATH, "sh", "-c", command)
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
@ -90,7 +92,7 @@ EOF
|
||||
|
||||
nsupdate -v -k <(printf '%%s' "${DDNS_KEY}") <(printf '%%s\n\n' "${COMMAND}")
|
||||
`, c.Key.Label, c.Key.Algorithm, c.Key.Secret, c.Server, record, strings.ToUpper(recordType))
|
||||
cmd := exec.Command("/usr/bin/env", "sh", "-c", command)
|
||||
cmd := exec.Command(ENV_PATH, "sh", "-c", command)
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
@ -122,7 +124,7 @@ EOF
|
||||
|
||||
nsupdate -v -k <(printf '%%s' "${DDNS_KEY}") <(printf '%%s\n\n' "${COMMAND}")
|
||||
`, c.Key.Label, c.Key.Algorithm, c.Key.Secret, c.Server, record, strings.ToUpper(recordType), value)
|
||||
cmd := exec.Command("/usr/bin/env", "sh", "-c", command)
|
||||
cmd := exec.Command(ENV_PATH, "sh", "-c", command)
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user