Support for multi-tenancy
This client depends on the filesystem and a specific dotenv configuration in order to configure the FCM client. My use case, however, requires working with a number of FCM credentials sourced from a database.
I think this depends on https://github.com/makarski/gauth-rs/issues/28
I'm willing to contribute this support myself :)
Very useful to have this more flexible indeed!
We could extract the credentials part from fcm::client::Client and create a Credentials struct for this, which is then used by Client. This new struct allows a filename or string for the config and calls ServiceAccount::from_string or similar for your usecase.
I was thinking very similar! We keep new() that defaults to ServiceAccount::from_file but then have a second method from_credentials() which accepts a string
This would also read the credentials file once on startup rather than twice for every message which is an important step for proper re-use of the Service Account access token.
Is support for hotswpping credential files on-disk an intentional feature? I'm thinking of removing this ability in my refactor as it would be simpler
I haven't given that much thought yet, no.