Skip to content
Snippets Groups Projects
Commit c8c7fbe9 authored by Wilson JALLET's avatar Wilson JALLET :money_with_wings:
Browse files

Change NODE_ENV use to TARGET_ENV

new variable used for target environment (dev, staging, production)
parent 5dd4cd8f
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ docker:build: ...@@ -51,7 +51,7 @@ docker:build:
script: script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- echo "Building Dockerfile..." - echo "Building Dockerfile..."
- docker build --pull -t ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG} -t ${CI_APPLICATION_REPOSITORY}:latest . - docker build --pull -t ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG} -t ${CI_APPLICATION_REPOSITORY}:latest --build-arg TARGET_ENV=staging .
- echo "Pushing to GitLab Container registry $CI_APPLICATION_REPOSITORY with tags '${CI_APPLICATION_TAG}' and 'latest'" - echo "Pushing to GitLab Container registry $CI_APPLICATION_REPOSITORY with tags '${CI_APPLICATION_TAG}' and 'latest'"
- docker push ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG} - docker push ${CI_APPLICATION_REPOSITORY}:${CI_APPLICATION_TAG}
- docker push ${CI_APPLICATION_REPOSITORY}:latest - docker push ${CI_APPLICATION_REPOSITORY}:latest
......
...@@ -10,7 +10,7 @@ COPY package*.json ./ ...@@ -10,7 +10,7 @@ COPY package*.json ./
# Install app dependencies # Install app dependencies
RUN npm install --only=production RUN npm install --only=production
ENV NODE_ENV=staging ARG TARGET_ENV
ENV LDAP_URI=http://frankiz.eleves.polytechnique.fr:389 ENV LDAP_URI=http://frankiz.eleves.polytechnique.fr:389
COPY . . COPY . .
......
/** /**
* @file Charge la configuration knexjs adaptée à l'environnement (production ou développement) puis exporte un objet knex permettant les requêtes SQL * @file Charge la configuration knexjs adaptée à l'environnement (production ou développement) puis exporte un objet knex permettant les requêtes SQL
*/ */
require('dotenv').config();
const environment = process.env.NODE_ENV || 'development'; const environment = process.env.TARGET_ENV || 'development';
const config = require('../knexfile')[environment]; const config = require('../knexfile')[environment];
console.log("Running Knex configuration '%s'", environment); console.log("Running Knex configuration '%s'", environment);
......
...@@ -199,7 +199,6 @@ app.post('/login', ...@@ -199,7 +199,6 @@ app.post('/login',
/** /**
* @desc API GraphQL * @desc API GraphQL
*/ */
const environment = process.env.NODE_ENV || 'development';
/** /**
* @desc Define GraphQL request context object, through a callback, with authorization. * @desc Define GraphQL request context object, through a callback, with authorization.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment