Skip to content

Commit

Permalink
adds directory file path as var to docker and heroku vars config
Browse files Browse the repository at this point in the history
  • Loading branch information
shakalee14 committed Sep 9, 2019
1 parent f62b917 commit 7f36906
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app.json
Expand Up @@ -156,8 +156,13 @@
"HEROKU_APP_NAME": {
"description": "Name of your Heroku app (not used if BASE_URL is set)",
"required": false
}
},

"KNEX_MIGRATION_DIR": {
"description": "sets path for migration directory - do not change",
"required": true,
"value": "/spoke/build/server/migrations/"
}
},
"addons": [
"heroku-postgresql:hobby-dev",
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Expand Up @@ -26,6 +26,7 @@ services:
environment:
DATABASE_URL: postgres://spoke:spoke@postgres:5432/spokedev
REDIS_URL: redis://redis:6379
KNEX_MIGRATION_DIR: /spoke/build/server/migrations/
ports:
- 3000:3000
volumes:
Expand Down
6 changes: 6 additions & 0 deletions src/server/knex-connect.js
Expand Up @@ -40,13 +40,19 @@ if (DB_JSON) {
user: DB_USER,
ssl: useSSL
},
migrations: {
directory: process.env.KNEX_MIGRATION_DIR || './migrations/'
},
pool: { min, max }
}
} else if (DATABASE_URL) {
const dbType = DATABASE_URL.match(/^\w+/)[0]
config = {
client: (/postgres/.test(dbType) ? 'pg' : dbType),
connection: DATABASE_URL,
migrations: {
directory: process.env.KNEX_MIGRATION_DIR || './migrations/'
},
pool: { min, max },
ssl: useSSL
}
Expand Down

0 comments on commit 7f36906

Please sign in to comment.