diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-10-16 14:54:39 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-10-16 15:09:15 +0200 |
commit | 38feca6e6ac6e91fd4b764c3cdf44cb9990da99a (patch) | |
tree | d43268689d3985cb6780b65c55f3b1f0c5980f7e /server/bin/settoken | |
parent | 5cbc75b23cd7e5aae41308b63b16fe44d5eb2a69 (diff) |
#988 Adapt settoken to the new json config file
This patch sets the renewed api_token in the config file ogserver.json
Diffstat (limited to 'server/bin/settoken')
-rwxr-xr-x | server/bin/settoken | 5 |
1 files changed, 2 insertions, 3 deletions
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. |