-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
closes #456 - update development setup #465
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/c0d3/c0d3-app/a3uwavdng |
helpers/dbload.ts
Outdated
@@ -13,6 +13,7 @@ const sequelize = new Sequelize( | |||
process.env.DB_PW || 'this', | |||
{ | |||
host: process.env.DB_HOST || 'city', | |||
port: ((process.env.DB_PORT as unknown) as number) || 5432, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this won't break production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will break production since 5432
is the default port for a postgresql database. I'm not sure if we have changed our configurations to use a different port.
However, I think that this port
key should only be added in when used for development. In case we are not using 5432
as the port for our production database, or in case the port for the database we use ever changes, this will ensure that nothing breaks.
import { Options, Sequelize } from 'sequelize'
// showing you the import so you can see where I got the Options type
const sequelizeOptions: Options = {
host: process.env.DB_HOST || 'city',
logging: false,
dialect: 'postgres',
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
}
if (process.env.MODE === 'DEV') {
sequelizeOptions.port = ((process.env.DB_PORT as unknown) as number) || 5432
}
const sequelize = new Sequelize(
process.env.DB_NAME || 'you',
process.env.DB_USER || 'failed',
process.env.DB_PW || 'this',
sequelizeOptions
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better safe than sorry. Done.
Codecov Report
@@ Coverage Diff @@
## master #465 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 89 91 +2
Lines 1202 1223 +21
Branches 256 254 -2
=========================================
+ Hits 1202 1223 +21
|
Nice work @Ulisseus, I believe the dev setup will be much easier now. @all-contributors please add @Ulisseus for code and documentation. |
I've put up a pull request to add @Ulisseus! 🎉 |
Fixes issue #456.
This PR will add step by step guide on how to configure fully local copy of c0d3 app. It comes with preconfigured docker compose (lesson/challenges data, admin user which has completed lesson 0 and is able to review new submissions).
Potential issues:
No tests for docker images, in theory I could try to start test containers, load dump and compare it to dummy lesson data, but should I? These tests won't be fast.
I explicitly added port in sequelize options, maybe I am overlooking something but sequelize refuses to work when you provide
host:port
in options. I even went as far as checking my hostfile since I use localhost, but I still couldn't figure it out.