From 9f4af0363367eedc965df59034fc3473eb92000b Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 29 Nov 2021 15:56:44 +0200 Subject: [PATCH] cors --- readmongo/swarmlab-app/src/run/app.js | 3 +- tools/poc-service-restart-dummy | 44 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 tools/poc-service-restart-dummy diff --git a/readmongo/swarmlab-app/src/run/app.js b/readmongo/swarmlab-app/src/run/app.js index b2b3108..a60c82c 100644 --- a/readmongo/swarmlab-app/src/run/app.js +++ b/readmongo/swarmlab-app/src/run/app.js @@ -19,7 +19,7 @@ const io = require("socket.io")(http, { // //transports: [ 'websocket', 'polling' ], // transports: [ 'polling', 'websocket' ], cors: { - origin: "http://localhost:8080", + origin: "http://localhost:8085", methods: ["GET", "POST"], allowedHeaders: ["my-custom-header"], credentials: true, @@ -75,6 +75,7 @@ const { MongoError } = require("mongodb"); const whitelist = [ "http://localhost:3000", "http://localhost:8080", + "http://localhost:8085", "http://localhost:3080", "http://localhost:3081", "http://localhost:3082", diff --git a/tools/poc-service-restart-dummy b/tools/poc-service-restart-dummy new file mode 100755 index 0000000..59802d5 --- /dev/null +++ b/tools/poc-service-restart-dummy @@ -0,0 +1,44 @@ +#!/bin/bash + + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + TARGET="$(readlink "$SOURCE")" + if [[ $TARGET == /* ]]; then + #echo "SOURCE '$SOURCE' is an absolute symlink to '$TARGET'" + SOURCE="$TARGET" + else + DIR="$( dirname "$SOURCE" )" + #echo "SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')" + SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located + fi +done + +SRPATH="$( dirname "$SOURCE" )" +SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ "$SFPATH" != "$SRPATH" ]; then + RDIR=$SRPATH # relativ path directory +fi + +cwdir=$PWD +wdir=$SFPATH + + +#[ $# -eq 0 ] && { echo "Usage: $0 service-name"; exit 1; } +#[ -z "$1" ] && { echo "Usage: $0 service-name"; exit 1; } + +dir="$1" + +docker-compose restart -t 0 readmongo + + + + + + + + + + + +