Skip to content
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

How Can I set Google Client options with this package? #5

Open
wammy21 opened this issue Apr 23, 2016 · 8 comments
Open

How Can I set Google Client options with this package? #5

wammy21 opened this issue Apr 23, 2016 · 8 comments

Comments

@wammy21
Copy link
Contributor

wammy21 commented Apr 23, 2016

I am having a problem with my server, I am running different laravel installs on one machine, but it seems they all want to use /tmp/Google_Client/ and it has now become an issue since the different sites run under different users.

Anyway the fix to what I am encountering is this:
http://stackoverflow.com/questions/17282894/a-client-error-occurred-could-not-create-storage-directory-tmp-google-client

Which is really just a matter of doing this:
$config = new Google_Config();
$config->setClassConfig('Google_Cache_File', array('directory' => '../tmp/cache'));
$client = new Google_Client($config);

Maybe add an option to set it via the config file or the .env?

@cedricziel
Copy link
Member

Yep. Agreed. I think the app-local tmp path should suffice - would you care to contribute a pull request?

@cedricziel
Copy link
Member

Reviewing the Google_Client we may be able to simply use

$client = new Google_Client();
$client->setCache(new Google_Cache_File('/path/to/shared/cache'));

On the long run it might be useful to implement some of the caching logic and set it dynamically to the most useful available cache backend. What do you think?

@wammy21
Copy link
Contributor Author

wammy21 commented Apr 25, 2016

Forgive me I've never contributed on github before but I will make an attempt :)

As far as your other comment, I think it should be an option on the driver config, perhaps 'cache_path' and default it to storage_path('framework/cache') or override via .env GCS_CACHE_PATH ?

@cedricziel
Copy link
Member

Exactly what I meant - maybe with the addition of GCS_CACHE_TYPE defaulting to 'file', resulting in Google_Cache_File instantiated.

I'll happily review your contribution - no worries about that :)

@emilv
Copy link

emilv commented Oct 18, 2016

I'm not a fan of file caching. It won't solve wammy21's permission problems either since Google_Client will continue setting very restrictive permissions.

Would it not be better to make everything about the Google_Client configurable so we can choose our own cache type?

@cedricziel
Copy link
Member

cedricziel commented Oct 18, 2016

What about simply wrapping the instance into the native flysystem cache decorator?

https://flysystem.thephpleague.com/caching/

@emilv
Copy link

emilv commented Oct 18, 2016

I think that's another kind of caching. The CachedAdapter seems to cache calls between the Flysystem adapter and the user; it is not a generic cache implementation that you can inject into the Google_Client itself. This issue is about configuring the Google_Client which requires a cache implementation adhering to their own interface so they can store auth tokens.

@wammy21
Copy link
Contributor Author

wammy21 commented Jun 12, 2017

@cedricziel I have finally been able to get around to doing this - please see pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants