summaryrefslogtreecommitdiffstats
path: root/server/lib/ogfunctions.sh
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2020-10-19 13:38:11 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-10-22 12:50:37 +0200
commit4972d15ecd21a6f8dfe6f8451d19ac678fa2865b (patch)
tree9cf270d2e9c9522a0f4590864082c14f96999a63 /server/lib/ogfunctions.sh
parenta0dd47a79ca4d5a06979fe22827bf7d4ea178fb7 (diff)
#988 Read json config file in scripts
This patch implements the function source_json_config() that is used to read the new ogserver.json config file in the scripts. This replaces the old 'source .../ogserver.cfg'. Co-authored-by: Javier Sánchez Parra <jsanchez@soleta.eu>
Diffstat (limited to 'server/lib/ogfunctions.sh')
-rwxr-xr-xserver/lib/ogfunctions.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/lib/ogfunctions.sh b/server/lib/ogfunctions.sh
index 30da3107..cf701925 100755
--- a/server/lib/ogfunctions.sh
+++ b/server/lib/ogfunctions.sh
@@ -110,6 +110,18 @@ function jq() {
echo "$OUTPUT"
}
+function source_json_config() {
+ FILE=$1
+ export ServidorAdm=$(jq -r ".rest.ip" $FILE)
+ export PUERTO=$(jq -r ".rest.port" $FILE)
+ export APITOKEN=$(jq -r ".rest.api_token" $FILE)
+ export USUARIO=$(jq -r ".database.user" $FILE)
+ export PASSWORD=$(jq -r ".database.pass" $FILE)
+ export datasource=$(jq -r ".database.ip" $FILE)
+ export CATALOG=$(jq -r ".database.name" $FILE)
+ export INTERFACE=$(jq -r ".wol.interface" $FILE)
+}
+
# Private function to acts on a service (do not use directly).
function _service() {
local ACTION="$1"