Commit 3c709103 authored by ncastejon's avatar ncastejon
Browse files
parents d72f41b7 92c1f239
Pipeline #2394 passed with stages
in 3 minutes and 32 seconds
......@@ -21,3 +21,5 @@ npm-debug.log
# Don't commit *.env except the template
*.env
!template.env
/dist
......@@ -84,4 +84,4 @@ db_migration-staging:
- npm install tsconfig-paths
script:
- export MIGRATION=1
- npm run typeorm:migrate-ci
\ No newline at end of file
- npm run typeorm:migrate-ci
......@@ -15,6 +15,6 @@ RUN npm install
# Bundle app source
COPY . .
CMD npm run start:dev
CMD ["sh","-c", "npm run typeorm:migrate-ci && npm run start:prod"]
EXPOSE 3000
......@@ -17,7 +17,7 @@ services:
- database-organizations
database-organizations:
image: postgres
image: postgres:11
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
......
import * as dotenv from 'dotenv';
import * as fs from 'fs';
// tslint:disable-next-line:no-var-requires
const dotenv = require('dotenv');
// tslint:disable-next-line:no-var-requires
const fs = require('fs');
let root = 'src';
// For prod build, the files are in a dist folder
if (process.env.PRODBUILD) {
root = 'dist';
}
// Only for development purpose, set environment variable based on the env file provided
if (process.env.NODE_ENV === 'LOCAL') {
......@@ -13,15 +22,15 @@ if (process.env.NODE_ENV === 'LOCAL') {
const ormConfig = {
type: 'postgres',
host: 'database-organizations',
host: process.env.POSTGRES_HOST,
port: process.env.POSTGRES_PORT,
username: 'user',
password: process.env.POSTGRES_PASSWORD,
database: 'postgres',
entities: ['src/**/**.entity{.ts,.js}'],
synchronize: false,
migrations: ['src/migrations/*.ts'],
cli: { migrationsDir: 'src/migrations' },
migrations: [`${root}/migrations/*.ts`],
cli: { migrationsDir: `${root}/migrations` },
logging: true,
};
......
......@@ -10,7 +10,7 @@
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json",
"prestart:prod": "rimraf dist && tsc",
"start:prod": "node dist/main.js",
"start:prod": "cross-env PRODBUILD=1 node dist/main.js",
"start:hmr": "node dist/server",
"lint": "tslint -p tsconfig.json -c tslint.json",
"test": "jest",
......
import { Module } from '@nestjs/common';
import { OrganizationsModule } from './organizations/organizations.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { LinksModule } from 'links/links.module';
import { LinksModule } from './links/links.module';
@Module({
imports: [TypeOrmModule.forRoot(), OrganizationsModule, LinksModule],
......
......@@ -3,8 +3,8 @@ import { OrganizationsController } from './organizations.controller';
import { OrganizationsService } from './organizations.service';
import { Organization } from './organization.entity';
import { TypeOrmModule } from '@nestjs/typeorm';
import { LinksService } from 'links/links.service';
import { LinksModule } from 'links/links.module';
import { LinksService } from '../links/links.service';
import { LinksModule } from '../links/links.module';
@Module({
imports: [TypeOrmModule.forFeature([Organization]), LinksModule],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment