Skip to content
Snippets Groups Projects
Commit 4f04032f authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Variabilize redis port

parent aec11be0
Branches
Tags
No related merge requests found
Pipeline #
......@@ -8,7 +8,8 @@ build_development:
- master
script:
- export NODE_ENV=DEV
- export PORT=3002
- export SERVICE_PORT=3002
- export REDIS_PORT=6380
- docker-compose --project-name service-authentication-dev build
deploy_development:
......@@ -17,7 +18,8 @@ deploy_development:
- master
script:
- export NODE_ENV=DEV
- export PORT=3002
- export SERVICE_PORT=3002
- export REDIS_PORT=6380
- docker-compose --project-name service-authentication-dev up -d
build_staging:
......@@ -26,7 +28,8 @@ build_staging:
- staging
script:
- export NODE_ENV=REC
- export PORT=3102
- export SERVICE_PORT=3102
- export REDIS_PORT=6379
- sed -i 's/DEV_/REC_/g' docker-compose.yml
- docker-compose --project-name service-authentication-rec build
......@@ -36,7 +39,8 @@ deploy_staging:
- staging
script:
- export NODE_ENV=REC
- export PORT=3102
- export SERVICE_PORT=3102
- export REDIS_PORT=6379
- sed -i 's/DEV_/REC_/g' docker-compose.yml
- docker-compose --project-name service-authentication-rec up -d
......@@ -2,10 +2,10 @@ version: '3.1'
services:
service-authentication:
container_name: service-authentication
container_name: service-authentication-${NODE_ENV}
build: .
ports:
- ${PORT}:3000
- ${SERVICE_PORT}:3000
environment:
- NODE_ENV=${NODE_ENV}
- POST_LOGOUT_REDIRECT_URI=${DEV_POST_LOGOUT_REDIRECT_URI}
......@@ -14,16 +14,16 @@ services:
- OIDC_CLIENT_SECRET=${DEV_OIDC_CLIENT_SECRET}
- GLC_CLIENT_ID=${DEV_GLC_CLIENT_ID}
- GLC_CLIENT_SECRET=${DEV_GLC_CLIENT_SECRET}
# depends_on:
# - redis
depends_on:
- redis
redis:
container_name: redis
container_name: redis-${NODE_ENV}
image: redis:5.0.0-alpine
command: ["redis-server", "--appendonly", "yes"]
hostname: redis
ports:
- 6379:6379
- ${REDIS_PORT}:6379
volumes:
- redis-data:/data
......
......@@ -3,10 +3,6 @@ import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
constructor() {}
@Get()
root(): string {
return this.appService.root();
}
}
......@@ -281,7 +281,7 @@ export class AuthenticationController {
connectToRedis(done) {
Logger.log(`[-] Connecting to redis`);
const client = redis.createClient({ host: 'redis', port: 6379 });
const client = redis.createClient({ host: this.conf.redis.host, port: this.conf.redis.port });
client.on('error', (err) => {
Logger.error(' [x] Error on redis client: ' + err);
......
......@@ -22,8 +22,9 @@ export class ConfigService {
private completeAuthenticationServiceConf() {
// Complete redirect uris conf
// Gitlab ci doesn't allow var env per environment so we need to set the env in front of the variable
this._config.redirect_uri = process.env[`REDIRECT_URI`];
this._config.post_logout_redirect_uri = process.env[`POST_LOGOUT_REDIRECT_URI`];
this._config.redirect_uri = process.env.REDIRECT_URI;
this._config.post_logout_redirect_uri = process.env.POST_LOGOUT_REDIRECT_URI;
this._config.redis.port = process.env.REDIS_PORT;
// Complete providers conf
for (const provider in this._config.providers) {
if (this._config.providers.hasOwnProperty(provider)) {
......
......@@ -18,5 +18,7 @@ export const Config = {
kongConsumers: 'http://192.168.62.15:9001/consumers',
redis: {
ttl: 300, // in seconds
port: null,
host: 'redis',
},
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment