-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
fix: Change to use database environment variables in dev mode #8951
base: main
Are you sure you want to change the base?
fix: Change to use database environment variables in dev mode #8951
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@0417taehyun is attempting to deploy a commit to the unleash-team Team on Vercel. A member of the Team first needs to authorize it. |
process.env.DATABASE_APPLICATION_NAME || | ||
'unleash', | ||
disableMigration: parseEnvVarBoolean( | ||
process.env.DATABASE_DISABLE_MIGRATION, |
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.
It would be better to handle migration flag through environment variable in dev mode because sometimes users don't want to run migration and they have to turn it off by fixing code if they can't handle it via environment variable.
@@ -61,7 +61,7 @@ | |||
"test:coverage:jest": "NODE_ENV=test PORT=4243 jest --silent --ci --json --coverage --testLocationInResults --outputFile=\"report.json\" --forceExit --testTimeout=10000", | |||
"test:updateSnapshot": "NODE_ENV=test PORT=4243 jest --updateSnapshot --testTimeout=10000", | |||
"seed:setup": "ts-node --compilerOptions '{\"strictNullChecks\": false}' src/test/e2e/seed/segment.seed.ts", | |||
"seed:serve": "UNLEASH_DATABASE_NAME=unleash_test UNLEASH_DATABASE_SCHEMA=seed yarn run start:dev", | |||
"seed:serve": "DATABASE_NAME=unleash_test DATABASE_SCHEMA=seed yarn run start:dev", |
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.
yarn seed:serve
also use start:dev
and it would be better to use the same environment variables instead of using different name such as UNLEASH_DATABASE_NAME
.
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.
Thanks! Left some suggestions for the docs.
Thanks! I applied your review on 34c6998 commit. |
I don't know why the test was failed even though I didn't change anything related of that 🤔 FAIL src/lib/features/metrics/instance/metrics.test.ts (8.894 s)
● bulk metrics › filters out metrics for environments we do not have access for. No auth setup so we can only access default env
expect(received).toHaveLength(expected)
Expected length: 1
Received length: 0
Received array: []
312 | );
313 | expect(developmentReport).toHaveLength(0);
> 314 | expect(defaultReport).toHaveLength(1);
| ^
315 | expect(defaultReport[0].yes).toBe(1000);
316 | });
317 |
at Object.toHaveLength (src/lib/features/metrics/instance/metrics.test.ts:314:31)
|
Thanks @0417taehyun! In general the changes seems fine. But could you update the description to explain which problem it is solving for you and put some words on how you run Unleash / postgres locally while developing Unleash. |
Hi, I've updated my description. Thanks! |
Hi, is there any progress of this? |
About the changes
Problems
server-dev.ts
code manually when trying to disable the migration even though it could be provided by the environment variable,DATABASE_DISABLE_MIGRATION
.Development Environment
.envrc
, which are the same ways that I've been using on development and production environment.Solutions
DATABASE_HOST
when running dev modeDiscussion points
In some cases, users want to use their pre-defined database in dev mode and now they only can use
DATABASE_URL
. However, it is more efficient to help them use separated options such asDATABASE_HOST
andDATABASE_PORT
.