From 84d3323856765a829bb06ac17f9aaef532b573cf Mon Sep 17 00:00:00 2001 From: roschaefer Date: Fri, 15 Nov 2019 11:32:53 +0100 Subject: [PATCH] refactor: remove redundant port configuration If you set GRAPQHL_URI the port is already in there --- backend/.env.template | 1 - backend/src/config/index.js | 2 -- backend/src/index.js | 3 ++- .../templates/configmap.template.yaml | 1 - docker-compose.maintenance.yml | 1 - docker-compose.yml | 1 - package.json | 11 +++++------ 7 files changed, 7 insertions(+), 13 deletions(-) diff --git a/backend/.env.template b/backend/.env.template index 5ecc5a5c4..b4c91da9a 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -1,7 +1,6 @@ NEO4J_URI=bolt://localhost:7687 NEO4J_USERNAME=neo4j NEO4J_PASSWORD=letmein -GRAPHQL_PORT=4000 GRAPHQL_URI=http://localhost:4000 CLIENT_URI=http://localhost:3000 SMTP_HOST= diff --git a/backend/src/config/index.js b/backend/src/config/index.js index 00361ba63..b67cea0f9 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -16,7 +16,6 @@ const { NEO4J_URI = 'bolt://localhost:7687', NEO4J_USERNAME = 'neo4j', NEO4J_PASSWORD = 'neo4j', - GRAPHQL_PORT = 4000, CLIENT_URI = 'http://localhost:3000', GRAPHQL_URI = 'http://localhost:4000', } = process.env @@ -36,7 +35,6 @@ export const smtpConfigs = { } export const neo4jConfigs = { NEO4J_URI, NEO4J_USERNAME, NEO4J_PASSWORD } export const serverConfigs = { - GRAPHQL_PORT, CLIENT_URI, GRAPHQL_URI, PUBLIC_REGISTRATION: process.env.PUBLIC_REGISTRATION === 'true', diff --git a/backend/src/index.js b/backend/src/index.js index 0e7fc233c..98354dc1f 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -2,7 +2,8 @@ import createServer from './server' import CONFIG from './config' const { app } = createServer() -app.listen({ port: CONFIG.GRAPHQL_PORT }, () => { +const url = new URL(CONFIG.GRAPHQL_URI) +app.listen({ port: url.port }, () => { /* eslint-disable-next-line no-console */ console.log(`GraphQLServer ready at ${CONFIG.GRAPHQL_URI} 🚀`) }) diff --git a/deployment/human-connection/templates/configmap.template.yaml b/deployment/human-connection/templates/configmap.template.yaml index 07c0bb53f..ae093e4bd 100644 --- a/deployment/human-connection/templates/configmap.template.yaml +++ b/deployment/human-connection/templates/configmap.template.yaml @@ -4,7 +4,6 @@ data: SMTP_HOST: "mailserver.human-connection" SMTP_PORT: "25" - GRAPHQL_PORT: "4000" GRAPHQL_URI: "http://nitro-backend.human-connection:4000" NEO4J_URI: "bolt://nitro-neo4j.human-connection:7687" NEO4J_AUTH: "none" diff --git a/docker-compose.maintenance.yml b/docker-compose.maintenance.yml index 52168c221..b6a869c57 100644 --- a/docker-compose.maintenance.yml +++ b/docker-compose.maintenance.yml @@ -15,7 +15,6 @@ services: environment: - NEO4J_dbms_security_auth__enabled=false - NEO4J_dbms_memory_heap_max__size=2G - - GRAPHQL_PORT=4000 - GRAPHQL_URI=http://localhost:4000 - CLIENT_URI=http://localhost:3000 - JWT_SECRET=b/&&7b78BF&fv/Vd diff --git a/docker-compose.yml b/docker-compose.yml index c5ce3a20f..7b0c00163 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,7 +39,6 @@ services: - uploads:/nitro-backend/public/uploads environment: - NEO4J_URI=bolt://neo4j:7687 - - GRAPHQL_PORT=4000 - GRAPHQL_URI=http://backend:4000 - CLIENT_URI=http://localhost:3000 - JWT_SECRET=b/&&7b78BF&fv/Vd diff --git a/package.json b/package.json index 38509a631..290834da4 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,11 @@ "scripts": { "db:seed": "cd backend && yarn run db:seed", "db:reset": "cd backend && yarn run db:reset", - "cypress:backend:server": "cd backend && yarn run test:before:server", - "cypress:backend:seeder": "cd backend && yarn run test:before:seeder", - "cypress:webapp": "cd webapp && cross-env GRAPHQL_URI=http://localhost:4123 yarn run dev", - "cypress:setup": "run-p cypress:backend:* cypress:webapp", - "cypress:run": "cypress run --browser chromium", - "cypress:open": "cypress open --browser chromium", + "cypress:backend": "cd backend && cross-env GRAPHQL_URI=http://localhost:4001 yarn run dev", + "cypress:webapp": "cd webapp && cross-env GRAPHQL_URI=http://localhost:4001 NUXT_PORT=3001 yarn run dev", + "cypress:setup": "run-p cypress:backend cypress:webapp", + "cypress:run": "cross-env CYPRESS_BASE_URL=http://localhost:3001 cypress run --browser chromium", + "cypress:open": "cross-env CYPRESS_BASE_URL=http://localhost:3001 cypress open --browser chromium", "test:jest": "cd webapp && yarn test && cd ../backend && yarn test:jest && codecov", "version": "auto-changelog -p" },