/
v-get-dns-domain-value
executable file
·57 lines (45 loc) · 1.66 KB
/
v-get-dns-domain-value
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# info: get dns domain value
# options: USER DOMAIN KEY
#
# example: v-get-dns-domain-value admin example.com SOA
#
# This function for getting a certain DNS domain parameter.
#----------------------------------------------------------#
# Variables & Functions #
#----------------------------------------------------------#
# Argument definition
user=$1
domain=$2
domain_idn=$2
key=$3
# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# load config file
source_conf "$HESTIA/conf/hestia.conf"
# Additional argument formatting
format_domain
format_domain_idn
# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN KEY'
is_format_valid 'user' 'domain' 'key'
is_object_valid 'user' 'USER' "$user"
is_object_valid 'dns' 'DOMAIN' "$domain"
key=$(echo "$key" | tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Print
get_object_value 'dns' 'DOMAIN' "$domain" "$key"
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit