Commit f241b5cd authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Initial commit

parents
all: mongodb-config
@echo "$$MONGODB_CONFIG" > /etc/config/mongodb
install -v -Dm755 mongodb /usr/share/easycwmp/functions
mongodb-config:
define MONGODB_CONFIG
config mongodb 'credentials'
option hostname ''
option database ''
option username ''
option password ''
endef
export MONGODB_CONFIG
#!/bin/sh
#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
# $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
# Default of $type = string
#############################
# Entry point functuons #
#############################
prefix_list="$prefix_list $DMROOT.MongoDB."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_MongoDB"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform entry_execute_method_root_MongoDB"
entry_execute_method_root_MongoDB() {
case "$1" in ""|"$DMROOT."|"$DMROOT.MongoDB."*)
common_execute_method_obj "$DMROOT.MongoDB." "0"
common_execute_method_param "$DMROOT.MongoDB.HostName" "1" "mongodb_get_hostname" "mongodb_set_hostname"
common_execute_method_param "$DMROOT.MongoDB.Database" "1" "mongodb_get_database" "mongodb_set_database"
common_execute_method_param "$DMROOT.MongoDB.UserName" "1" "mongodb_get_username" "mongodb_set_username"
common_execute_method_param "$DMROOT.MongoDB.Password" "1" "" "mongodb_set_password"
return 0;
;;
esac
return $E_INVALID_PARAMETER_NAME;
}
#######################################
# Data model parameters functions #
#######################################
mongodb_get_hostname() {
echo `$UCI_GET mongodb.credentials.hostname`
}
mongodb_set_hostname() {
local hostname=`$UCI_GET mongodb.credentials.hostname`
if [ "$hostname" != "$1" ]; then
$UCI_SET mongodb.credentials.hostname="$1"
$UCI_COMMIT
chmod a+r /etc/config/mongodb
fi
}
mongodb_get_database() {
echo `$UCI_GET mongodb.credentials.database`
}
mongodb_set_database() {
local database=`$UCI_GET mongodb.credentials.database`
if [ "$database" != "$1" ]; then
$UCI_SET mongodb.credentials.database="$1"
$UCI_COMMIT
chmod a+r /etc/config/mongodb
fi
}
mongodb_get_username() {
echo `$UCI_GET mongodb.credentials.username`
}
mongodb_set_username() {
local username=`$UCI_GET mongodb.credentials.username`
if [ "$username" != "$1" ]; then
$UCI_SET mongodb.credentials.username="$1"
$UCI_COMMIT
chmod a+r /etc/config/mongodb
fi
}
mongodb_set_password() {
local password=`$UCI_GET mongodb.credentials.password`
if [ "$password" != "$1" ]; then
$UCI_SET mongodb.credentials.password="$1"
$UCI_COMMIT
chmod a+r /etc/config/mongodb
fi
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment