Skip to content

Commit

Permalink
Heroku using postgres SSL connection
Browse files Browse the repository at this point in the history
  • Loading branch information
javieraviles committed Jun 1, 2018
1 parent a2c7ec1 commit b5da280
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .example.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
NODE_PORT=3000
NODE_ENV=development
JWT_SECRET=your-secret-whatever
DATABASE_URL=postgres://user:pass@localhost:5432/apidb
TYPEORM_DRIVER_TYPE=postgres
DATABASE_URL=postgres://user:pass@localhost:5432/apidb
9 changes: 6 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const connectionOptions = PostgressConnectionStringParser.parse(process.env.DATA
// note that its not active database connection
// TypeORM creates you connection pull to uses connections from pull on your requests
createConnection({
type: process.env.TYPEORM_DRIVER_TYPE,
type: 'postgres',
host: connectionOptions.host,
port: connectionOptions.port,
username: connectionOptions.user,
Expand All @@ -32,8 +32,11 @@ createConnection({
synchronize: true,
logging: false,
entities: [
'src/entity/**/*.ts'
]
'dist/entity/**/*.js'
],
extra: {
ssl: true,
}
}).then(async connection => {

const app = new Koa();
Expand Down

0 comments on commit b5da280

Please sign in to comment.