From 38feca6e6ac6e91fd4b764c3cdf44cb9990da99a Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Fri, 16 Oct 2020 14:54:39 +0200 Subject: #988 Adapt settoken to the new json config file This patch sets the renewed api_token in the config file ogserver.json --- server/bin/settoken | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'server/bin') diff --git a/server/bin/settoken b/server/bin/settoken index 159c4c68..3bb191d7 100755 --- a/server/bin/settoken +++ b/server/bin/settoken @@ -15,7 +15,7 @@ # Global constants. OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} -SERVERCFG=$OPENGNSYS/etc/ogserver.cfg # Configuration files. +SERVERCFG=$OPENGNSYS/etc/ogserver.json REPOCFG=$OPENGNSYS/etc/ogAdmRepo.cfg # Functions. @@ -47,7 +47,6 @@ case "${1,,}" in esac [ "$USER" != "root" ] && raiseError access "Need to be root" [ -w $SERVERCFG ] || raiseError access "Server configuration file" -source $SERVERCFG # Update user token. if [ "$OGUSER" ]; then @@ -69,7 +68,7 @@ if [ "$SERVER" ]; then [ "${ANSWER,,}" != "y" ] && raiseError cancel "API tokens not updated" fi APIKEY="$(new_token)" - sed -i -n -e "/^APITOKEN=/!p" -e "$ a\APITOKEN=$APIKEY" $SERVERCFG || raiseError access "Cannot update server file" + sed -i "s/\"api_token\": \".*\"/\"api_token\": \"$APIKEY\"/" $SERVERCFG || raiseError access "Cannot update server file" fi # Update repository token. -- cgit v1.2.3-18-g5258