Skip to content

Commit

Permalink
edit env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienBtr committed Nov 14, 2020
1 parent cfc22e3 commit 71ee983
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 17 deletions.
4 changes: 3 additions & 1 deletion generator/generators/app/copyVariableFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ const ports = require('./usedPorts.json');

module.exports.run = (self, addEvents, apiSpec) => {
let port = 3500;
let dbport = 5400;
while (ports.used.includes(port)) {
port += 1;
dbport += 1;
}

self.fs.copyTpl(
Expand All @@ -20,7 +22,7 @@ module.exports.run = (self, addEvents, apiSpec) => {
self.fs.copyTpl(
self.templatePath('docker-compose.local.yaml.ejs'),
self.destinationPath('docker-compose.local.yaml'),
{ port },
{ port, dbport },
);

ports.used.push(port);
Expand Down
3 changes: 2 additions & 1 deletion generator/generators/app/templates/.env.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SERVER_PORT=3500
SERVER_EXPOSED_PORT=
DB_EXPOSED_PORT=

PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£

Expand Down
3 changes: 2 additions & 1 deletion generator/generators/app/templates/.env.default.with-kafka
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SERVER_PORT=3500
SERVER_EXPOSED_PORT=
DB_EXPOSED_PORT=

PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
app:
ports:
- '${SERVER_PORT:-<%= port %>}:3500'
- '${SERVER_EXPOSED_PORT:-<%= port %>}:3500'
networks:
- kafka_broker

Expand All @@ -23,6 +23,8 @@ services:

postgres:
image: postgres:10.3
ports:
- '${DB_EXPOSED_PORT:-<%= dbport %>}:5432'
restart: always
networks:
- postgres
Expand Down
2 changes: 1 addition & 1 deletion services/api-gateway/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
volumes:
- .:/etc/krakend
ports:
- "${API_PORT:-8080}:8080"
- "${API_PORT:-9898}:8080"
depends_on:
- influxdb
- jaeger
Expand Down
3 changes: 2 additions & 1 deletion services/article/.env.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SERVER_PORT=3500
SERVER_EXPOSED_PORT=
DB_EXPOSED_PORT=

PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£

Expand Down
4 changes: 3 additions & 1 deletion services/article/docker-compose.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
app:
ports:
- '${SERVER_PORT:-3502}:3500'
- '${SERVER_EXPOSED_PORT:-3502}:3500'
networks:
- kafka_broker

Expand All @@ -23,6 +23,8 @@ services:
postgres:
image: postgres:10.3
ports:
- '${DB_EXPOSED_PORT:-5402}:5432'
restart: always
networks:
- postgres
Expand Down
2 changes: 1 addition & 1 deletion services/auth/.env.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SERVER_PORT=3500
SERVER_EXPOSED_PORT=

USER_SERVICE=http://user_app_1:3500

Expand Down
2 changes: 1 addition & 1 deletion services/auth/docker-compose.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
app:
ports:
- '${SERVER_PORT:-3505}:3500'
- '${SERVER_EXPOSED_PORT:-3505}:3500'
networks:
- kafka_broker

Expand Down
3 changes: 2 additions & 1 deletion services/cart/.env.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SERVER_PORT=3500
SERVER_EXPOSED_PORT=
DB_EXPOSED_PORT=

PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£

Expand Down
4 changes: 3 additions & 1 deletion services/cart/docker-compose.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
app:
ports:
- '${SERVER_PORT:-3503}:3500'
- '${SERVER_EXPOSED_PORT:-3503}:3500'
networks:
- kafka_broker

Expand All @@ -23,6 +23,8 @@ services:
postgres:
image: postgres:10.3
ports:
- '${DB_EXPOSED_PORT:-5403}:5432'
restart: always
networks:
- postgres
Expand Down
2 changes: 1 addition & 1 deletion services/documentation/.env.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SERVER_PORT=3500
SERVER_EXPOSED_PORT=

EXTERNAL_PORT=9898
EXTERNAL_HOST=http://localhost
Expand Down
2 changes: 1 addition & 1 deletion services/documentation/docker-compose.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ version: "3"
services:
app:
ports:
- "${SERVER_PORT:-3501}:3500"
- "${SERVER_EXPOSED_PORT:-3501}:3500"
4 changes: 2 additions & 2 deletions services/documentation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require('dotenv').config();
const app = express();
const port = 3500;

const externalHost = process.env.EXTERNAL_HOST;
const externalPort = process.env.EXTERNAL_PORT;
const externalHost = process.env.EXTERNAL_HOST || 'http://localhost';
const externalPort = process.env.EXTERNAL_PORT || 9898;

/**
* Configure winston
Expand Down
3 changes: 2 additions & 1 deletion services/user/.env.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SERVER_PORT=3500
SERVER_EXPOSED_PORT=
DB_EXPOSED_PORT=

PRISMA_MANAGEMENT_API_SECRET=wsflk897dh%£

Expand Down
4 changes: 3 additions & 1 deletion services/user/docker-compose.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
app:
ports:
- '${SERVER_PORT:-3506}:3500'
- '${SERVER_EXPOSED_PORT:-3506}:3500'
networks:
- kafka_broker

Expand All @@ -23,6 +23,8 @@ services:
postgres:
image: postgres:10.3
ports:
- '${DB_EXPOSED_PORT:-5406}:5432'
restart: always
networks:
- postgres
Expand Down

0 comments on commit 71ee983

Please sign in to comment.