forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add system wide alert when converting to dev site
- Loading branch information
Showing
1 changed file
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,53 @@ | ||
#! /bin/bash | ||
|
||
sed -i 's/biblioteca.sistedes.es/bdsistedes.dsic.upv.es/g' /opt/dspace.ui/config/config.prod.yml | ||
sed -i 's/biblioteca.sistedes.es/bdsistedes.dsic.upv.es/g' /opt/dspace.server/config/local.cfg | ||
prodsite=biblioteca.sistedes.es | ||
devsite=bdsistedes.dsic.upv.es | ||
cookies=/tmp/bdcookies.tmp | ||
headers=/tmp/bdheaders.tmp | ||
user=USER_EMAIL | ||
password=USER_PASSWORD | ||
|
||
sed -i "s/$prodsite/$devsite/g" /opt/dspace.ui/config/config.prod.yml | ||
sed -i "s/$prodsite/$devsite/g" /opt/dspace.server/config/local.cfg | ||
|
||
function get_header() { | ||
cat /tmp/bdheaders.tmp | grep $1 | cut -d ':' -f2 | xargs | ||
} | ||
|
||
curl --silent \ | ||
--output /dev/null \ | ||
--cookie-jar $cookies \ | ||
--dump-header $headers \ | ||
'http://localhost:8080/dspace.server/api/' | ||
|
||
token=$(csfr_token DSPACE-XSRF-TOKEN) | ||
|
||
curl --silent \ | ||
--output /dev/null \ | ||
--cookie $cookies \ | ||
--cookie-jar $cookies \ | ||
--dump-header $headers \ | ||
'http://localhost:8080/dspace.server/api/authn/login' \ | ||
-H "X-XSRF-TOKEN: $token" \ | ||
--data-urlencode "user=$user" \ | ||
--data-urlencode "password=$password" | ||
|
||
token=$(get_header DSPACE-XSRF-TOKEN) | ||
auth=$(get_header Authorization) | ||
|
||
curl --silent \ | ||
--output /dev/null \ | ||
--cookie $cookies \ | ||
--cookie-jar $cookies \ | ||
--dump-header $headers \ | ||
-X PUT \ | ||
'http://localhost:8080/dspace.server/api/system/systemwidealerts/1' \ | ||
-H "Content-Type: application/json" \ | ||
-H "X-XSRF-TOKEN: $token" \ | ||
-H "Authorization: $auth" \ | ||
--data '{ "message": "<b>Este es un sitio de desarrollo y pruebas</b>", "countdownTo": null, "allowSessions": "all", "active": true }' | ||
|
||
rm -rf $cookies $headers | ||
|
||
systemctl restart tomcat9.service | ||
pm2 restart all |