Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Postgraphile config #79

Merged
merged 1 commit into from
Apr 16, 2019
Merged

Postgraphile config #79

merged 1 commit into from
Apr 16, 2019

Conversation

ana0
Copy link
Contributor

@ana0 ana0 commented Apr 15, 2019

Thought this would be helpful, as vulcanize opens up to people writing their own transformers

Copy link
Contributor

@rmulhol rmulhol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these improvements! Definitely seems like a win for supporting custom schemas. Mostly LGTM but I'm wondering if we want to force the user to define CONFIG_PATH themselves and error if it's undefined. Would also be cool to squash these commits

@@ -7,6 +7,7 @@
"lint": "tslint --project ./tsconfig.json --config ./tslint.json",
"postinstall": "rm -rf node_modules/@graphile && mkdir node_modules/@graphile && cp -R ./vendor/postgraphile-supporter/ ./node_modules/@graphile/plugin-supporter/",
"start": "npm run build && node ./build/dist/vulcanize-postgraphile-server.js",
"dev": "./node_modules/typescript/bin/tsc && CONFIG_PATH='./config.toml' node build/dist/src/index.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to set the CONFIG_PATH env variable here? seems like it could override one that's defined by the user, which might be confusing. also it seems like the user may need to create this file since I think it'll be ignored by git?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't need to be defined, here, was just for dev purposes - will remove. And yup, currently the user would need to create the config file/the config file is optional

@ana0
Copy link
Contributor Author

ana0 commented Apr 15, 2019

Thanks for these improvements! Definitely seems like a win for supporting custom schemas. Mostly LGTM but I'm wondering if we want to force the user to define CONFIG_PATH themselves and error if it's undefined. Would also be cool to squash these commits

Thanks for the review, will squash 👍 Also, just wanna clarify what you mean about throw an error if CONFIG_PATH is undefined? Are you saying it will currently do that, or that it should do that?

Right now it won't throw an error if undefined, with the thinking that it would be good to preserve the ability for the user have no config file and pass in the database variables directly as described in the rest of the readme. Can switch to making CONFIG_PATH required if you prefer though

@rmulhol
Copy link
Contributor

rmulhol commented Apr 15, 2019

Ah I see, that makes sense - I was thinking that it should throw an error, but I like your idea of allowing the user to pass it in directly without a config file.

@ana0 ana0 force-pushed the postgraphileConfig branch from 0c2cea7 to 12c28e4 Compare April 15, 2019 18:17
@ana0
Copy link
Contributor Author

ana0 commented Apr 15, 2019

Cool :) Was trying to avoid breaking anyone else's set up!

@ana0 ana0 requested a review from rmulhol April 16, 2019 11:32
database = parsedToml['database']['name'];
user = parsedToml['database']['user'];
password = parsedToml['database']['password'];
schemas = parsedToml['database']['schemas'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to update or modify the code below that's assigning based on process.env?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would think we don't need to, since the schemas var defaults to ["public"]. We could at some point, but my understanding is that an array env var will introduce further complications

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge for now, but happy to revisit :)

Copy link
Contributor

@rmulhol rmulhol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Curious about the process.env stuff but happy to go with whatever you think is best there

Copy link
Collaborator

@i-norden i-norden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM2! I can't think of anything to add to Rob's review.

@ana0 ana0 merged commit c6de4a4 into staging Apr 16, 2019
@ana0 ana0 deleted the postgraphileConfig branch April 16, 2019 18:29
i-norden pushed a commit that referenced this pull request Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants