You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.7 KiB
74 lines
1.7 KiB
#!/bin/bash
|
|
# info: list postgresql config parameters
|
|
# options: [FORMAT]
|
|
#
|
|
# example: v-list-sys-pgsql-config
|
|
#
|
|
# This function for obtaining the list of postgresql config parameters.
|
|
|
|
#----------------------------------------------------------#
|
|
# Variables & Functions #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
format=${1-shell}
|
|
|
|
# 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"
|
|
|
|
# JSON list function
|
|
json_list() {
|
|
echo '{
|
|
"CONFIG": {
|
|
"pg_hba_path": "'$pg_hba_path'",
|
|
"config_path": "'$config_path'"
|
|
}
|
|
}'
|
|
}
|
|
|
|
# SHELL list function
|
|
shell_list() {
|
|
echo "config_path: $config_path"
|
|
echo "pg_hba_path: $pg_hba_path"
|
|
}
|
|
|
|
# PLAIN list function
|
|
plain_list() {
|
|
echo -e "$config_path\t$pg_hba_path"
|
|
}
|
|
|
|
# CSV list function
|
|
csv_list() {
|
|
echo "config_path,pg_hba_path"
|
|
echo "$config_path,$pg_hba_path"
|
|
}
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Defining config path
|
|
config_path=$(find /etc/postgresql /var/lib/pgsql/data -name \
|
|
postgresql.conf 2> /dev/null)
|
|
pg_hba_path=$(find /etc/postgresql /var/lib/pgsql/data -name \
|
|
pg_hba.conf 2> /dev/null)
|
|
|
|
# Listing data
|
|
case $format in
|
|
json) json_list ;;
|
|
plain) plain_list ;;
|
|
csv) csv_list ;;
|
|
shell) shell_list ;;
|
|
esac
|
|
|
|
#----------------------------------------------------------#
|
|
# Hestia #
|
|
#----------------------------------------------------------#
|
|
|
|
exit
|