Skip to content

Commit

Permalink
Merge pull request #1 from damien-duignan/deploy
Browse files Browse the repository at this point in the history
Use connection string
  • Loading branch information
damien-duignan authored Jun 9, 2020
2 parents 29b0d15 + 499a191 commit 8c31853
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/walhall-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Walhall CI

on:
push:
branches:
- deploy

jobs:
push-to-humanitec-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build and Push to Humanitec Dev
uses: humanitec/build-push-to-humanitec@v1
with:
humanitec-token: ${{ secrets.HUMANITEC_TOKEN_DEV }}
organization: damien85
humanitec-registry: dev-registry.humanitec.io
humanitec-api: dev-api.humanitec.io
1 change: 1 addition & 0 deletions bin/init_db.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const db = require("../db");


console.log("[init_db.js] Initializing database");
console.log(`[init_db.js] CONNECTION_STRING="${process.env.CONNECTION_STRING || ""}"`);
console.log(`[init_db.js] DATABASE_USER="${process.env.DATABASE_USER || ""}"`);
console.log(`[init_db.js] DATABASE_HOST="${process.env.DATABASE_HOST || ""}"`);
console.log(`[init_db.js] DATABASE_NAME="${process.env.DATABASE_NAME || ""}"`);
Expand Down
6 changes: 1 addition & 5 deletions db/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const { Pool } = require("pg");

const pool = new Pool({
user: process.env.DATABASE_USER,
host: process.env.DATABASE_HOST,
database: process.env.DATABASE_NAME,
password: process.env.DATABASE_PASSWORD,
port: process.env.DATABASE_PORT,
connectionString: `${process.env.CONNECTION_STRING}`
});

module.exports = {
Expand Down
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ services:
- productdb

environment:
DATABASE_HOST: productdb
DATABASE_NAME: product
DATABASE_USER: product_robot
DATABASE_PASSWORD: "pr0dr0b0t"
CONNECTION_STRING: postgresql://product_robot:pr0dr0b0t@productdb:5432/product

productdb:
image: postgres:11
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"express-promise-router": "^3.0.3",
"morgan": "^1.9.1",
"path": "^0.12.7",
"pg": "^7.12.1"
"pg": "^8.2.1"
}
}

0 comments on commit 8c31853

Please sign in to comment.