Browse Source

Enable CORS for custom port

Nicolas Meienberger 3 years ago
parent
commit
eac3b9d6e1
4 changed files with 10 additions and 4 deletions
  1. 1 0
      docker-compose.yml
  2. 2 2
      packages/system-api/src/config/config.ts
  3. 0 1
      requirements.txt
  4. 7 1
      scripts/start.sh

+ 1 - 0
docker-compose.yml

@@ -29,6 +29,7 @@ services:
       - TIPI_VERSION=${TIPI_VERSION}
       - TIPI_VERSION=${TIPI_VERSION}
       - JWT_SECRET=${JWT_SECRET}
       - JWT_SECRET=${JWT_SECRET}
       - ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST}
       - ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST}
+      - NGINX_PORT=${NGINX_PORT}
     networks:
     networks:
       - tipi_main_network
       - tipi_main_network
 
 

+ 2 - 2
packages/system-api/src/config/config.ts

@@ -11,13 +11,13 @@ interface IConfig {
 
 
 dotenv.config();
 dotenv.config();
 
 
-const { NODE_ENV = 'development', JWT_SECRET = '', INTERNAL_IP = '', TIPI_VERSION = '', ROOT_FOLDER_HOST = '' } = process.env;
+const { NODE_ENV = 'development', JWT_SECRET = '', INTERNAL_IP = '', TIPI_VERSION = '', ROOT_FOLDER_HOST = '', NGINX_PORT = '80' } = process.env;
 
 
 const config: IConfig = {
 const config: IConfig = {
   NODE_ENV,
   NODE_ENV,
   ROOT_FOLDER: '/tipi',
   ROOT_FOLDER: '/tipi',
   JWT_SECRET,
   JWT_SECRET,
-  CLIENT_URLS: ['http://localhost:3000', `http://${INTERNAL_IP}`, `http://${INTERNAL_IP}:3000`],
+  CLIENT_URLS: ['http://localhost:3000', `http://${INTERNAL_IP}`, `http://${INTERNAL_IP}:${NGINX_PORT}`, `http://${INTERNAL_IP}:3000`],
   VERSION: TIPI_VERSION,
   VERSION: TIPI_VERSION,
   ROOT_FOLDER_HOST,
   ROOT_FOLDER_HOST,
 };
 };

+ 0 - 1
requirements.txt

@@ -1 +0,0 @@
-ansible

+ 7 - 1
scripts/start.sh

@@ -217,6 +217,12 @@ cat <<"EOF"
      |     {__)           
      |     {__)           
            ()`     
            ()`     
 EOF
 EOF
+
+port_display=""
+if [[ $NGINX_PORT != "80" ]]; then
+  port_display=":${NGINX_PORT}"
+fi
+
 echo ""
 echo ""
-echo "Visit http://${INTERNAL_IP}/ to view the dashboard"
+echo "Visit http://${INTERNAL_IP}${port_display}/ to view the dashboard"
 echo ""
 echo ""