-
Notifications
You must be signed in to change notification settings - Fork 33
Disable default mutations is now in config file #89
Conversation
@ana0 Hey! Personally can't find a reason to have GQL mutations at all for vDB. This should indeed be the default, but I don't think we need this embedded postgraphile code any more. AFAIK the before-it-was-open-source subscription stuff was the only reason for using postgraphile as a library, so I think we should be able to use the postgraphile binary externally and use ye olde' CLI flags to configure everything we need 🤷♀️ That'd mean the only connection between vDB and postgraphile would be some I haven't found the time to try it our properly yet, but I think @elizabethengelman has done some tests on this? |
Veriledger needs mutations in order to add new addresses and contracts to the account transformer (just for the |
@ana0 Ah, that's cool. Then definitely go ahead with this for now. When we phase out postgraphile from this codebase it'll be easier for everyone, instead of having to build it from source etc. AFAIK one would just invokes the vanilla postgraphile binary and pass some configuration flags we would list in the README. |
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.
🚀
@@ -37,6 +38,9 @@ export function parseConfig( | |||
gqSchemas = parsedToml['database']['gq_schemas']; | |||
gqUser = parsedToml['database']['gq_user'] || gqUser; | |||
gqPassword = parsedToml['database']['gq_password'] || gqPassword; | |||
disableDefaultMutations = parsedToml['database']['disable_default_mutations'] === undefined |
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'm no TS/JS wizard, what's the difference between this and the disjunctions above? I think this would behave unexpectedly on an empty string for example.
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.
Do you mean if there were an empty string in the config.toml? In that case, it'll ignore the incorrect var and keep the default true
. I did it this way because there are expected cases where disableDefaultMutations
will be falsey.
So, if disable_default_mutations = false
in the config.toml, disableDefaultMutations = parsedToml['database']['disable_default_mutations'] || true;
would still end up true.
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.
Ah, makes sense 👌
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.
LGTM! I just have a single comment, not blocking.
I am definitely all for removing Postgraphile entirely from this codebase in the future, if possible.
postgraphile/README.md
Outdated
@@ -23,8 +23,7 @@ Build the docker image in this directory. Start the `GraphiQL` frontend by: | |||
* GraphiQL frontend is available at `:3000/graphiql` | |||
GraphQL endpoint is available at `:3000/graphql` | |||
|
|||
By default, this build will expose only the "public" schema - to add other schemas, use either the env variables, | |||
or a config file `config.toml` and set the env var `CONFIG_PATH` to point to its location. Example `toml`: | |||
By default, this build will expose only the "public" schema and will disable mutations - to change mutation behaviour, you can use an optional config file `config.toml` and set the env var `CONFIG_PATH` to point to its location. Example `toml`: |
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.
This isn't specific to this PR since CONFIG_PATH
was introduced earlier, but I wonder if we should use a more specific env variable name for this? How "hard-coded" is this in Postgraphile? Seems unlikely but CONFIG_PATH
is pretty generic and could potentially run into a conflict.
* Use transformer factory for Bite - introduces separate transformer factory for non-LogNote events - converter includes `ToEntities` for events defined via ABI * Updates after rebasing with staging
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.
This looks good to me. I am partial to Ian's comment about potentially changing the name of the environment variable if we can, but not sure if that's out of scope. Also wanted to check in on whether #90 serves our use cases - feel like it might obsolete this PR but also don't want to fire away if it turns out that folks won't be able to run postgraphile how they want without the bespoke code.
I just pushed to change |
@ana0 For reference, this seems to do the trick for us (sans
Should be equivalent to the bespoke setup, modulo the |
Do folks think it should be an env var too?