Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Make it better
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowlik committed Apr 8, 2019
1 parent 93a7ee2 commit 42a9bdc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
NODE_ENV=development
NODE_ENV=development
DATABASE_URI=mongodb://mongodb/muchas
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@ services:
environment:
- NODE_ENV
- DEBUG_PORT
- DATABASE_URI
volumes:
- ./:/app
ports:
- 6028:6028
networks:
- muchas
command: npm run start:dev
mongodb:
image: mongo
logging:
driver: none
volumes:
- /data/db
ports:
- 27017:27017
networks:
- muchas
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:6.7.1
logging:
Expand Down
2 changes: 0 additions & 2 deletions src/database/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import mongoose from 'mongoose';

import { log } from '../index';

interface DatabaseOptions {
uri: string;
};
Expand Down
13 changes: 8 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class Muchas {
constructor() {
const {
LOGGER_ELASTIC_HOST,
LOGGER_ELASTIC_LEVEL
LOGGER_ELASTIC_LEVEL,
DATABASE_URI
} = process.env;

// Logger
Expand All @@ -35,11 +36,13 @@ class Muchas {
log = this.Log;

// Database
this.Database = new Database({
uri: '',
});
if (DATABASE_URI) {
this.Database = new Database({
uri: DATABASE_URI,
});

db = this.Database;
db = this.Database;
}
};

async init (): Promise<void> {
Expand Down

0 comments on commit 42a9bdc

Please sign in to comment.