Closed gsamokovarov closed 4 years ago
Hey @gsamokovarov!
Another aspect that is problematic for us is the configuration that is currently limited only to environment variables, as we're not keeping a "global" anyway config object reference, but instantiating it when needed and this supports configuration only through ENV variables, as far as I understand Anyway.
Anyway Config can load data from YAML configs. For example:
# config/graphql_anycable.yml
production:
subscription_expiration_seconds: 300
use_redis_object_on_cleanup: true
And I think, that should be the preferred option (not ENV) since these values are likely to be configured once and contain no sensitive information (so, it's okay to store them in the repo). @Envek WDYT? Maybe, we should update the readme or at least add a note about YAML-based configuration.
And I'm 👍 for extracting Cleaner
into a module.
Thanks, Vlad! Didn't know about the YML config files support in anyway
.
At Receipt Bank, we're using GraphQL Subscriptions with
graphql-anycable
, but we cannot easily execute rake tasks as periodical jobs and we had to copy-paste the rake task code into a job we can call. It would be way easier for setups like ours if we can invoke the cleaning process through plain Ruby code. This is whereGraphQL::Anycable::Cleaner.clean
comes in. If we can execute this in our periodic job, everything will be way easier.Another aspect that is problematic for us is the configuration that is currently limited only to environment variables, as we're not keeping a "global" anyway config object reference, but instantiating it when needed and this supports configuration only through ENV variables, as far as I understand
Anyway
.Having a global
GraphQL::Anyway.config
(and the syntax sugar ofGraphQL::Anyway.configure
) will help us avoid monkey patches we have tographql-anycable
to share a global config forsubscription_expiration_seconds
we set through our custom configuration management solution.What do you think about those changes? I haven't figured out a simple way to unit-test the changes, but have tested them against a fork of our app and seem to work.