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

Cache dir on env #393

Closed
raul3k opened this issue Jun 9, 2022 · 2 comments · Fixed by #396
Closed

Cache dir on env #393

raul3k opened this issue Jun 9, 2022 · 2 comments · Fixed by #396

Comments

@raul3k
Copy link

raul3k commented Jun 9, 2022

Note: Please report any security issues directly to hello [at] ankit.pl

Describe the bug
When you access this library with another library, like Vimeo/Laravel, the cache dir is not writable.

{"message":"fopen(/var/www/html/storage/app/public/): failed to open stream: Is a directory","context":{"userId":1,"exception":{"class":"ErrorException","message":"fopen(/var/www/html/storage/app/public/): failed to open stream: Is a directory","code":0,"file":"/var/www/html/vendor/league/flysystem/src/Adapter/Local.php:157"}}

If there was a way to set the cache dir outside vendor would be great, it avoid to set another step in deploy.

In the file:/vendor/ankitpokhrel/tus-php/src/Config/server.php, the file cache config is set to vendor folder, its not configurable.
Woul be great to set the cache dir due to server restrictibility.

'file' => [
        'dir' => \dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . '.cache' . DIRECTORY_SEPARATOR,
        'name' => 'tus_php.server.cache',
    ],

To something like this:

´file' => [
        'dir' => getenv('TUS_CACHE_DIR') !== false ? getenv('TUS_CACHE_DIR') :   \dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . '.cache' . DIRECTORY_SEPARATOR,
        'name' => 'tus_php.server.cache',
    ],

To Reproduce
Steps to reproduce the behavior:

  1. Setup laravel (with Laravel Nova in my specific case)
  2. Install vimeo/laravel
  3. Try to upload a new video
  4. See error

Expected behavior
Video was uploaded successfully. No error due to unwritable cache folder

Additional context
What I'm trying to do is to upload a new video to vimeo, using the offical vimeo/laravel package.
When I set the owner of the folder to www-data, works fine, but i have to add another deploy step to do so (in the buildspec file to be more exact)

@ankitpokhrel
Copy link
Owner

Fixed in #396. You can use TUS_CACHE_HOME or XDG_CACHE_HOME env to change cache dir for the file cache. Release pending.

@raul3k
Copy link
Author

raul3k commented Jun 20, 2022

Thank you @ankitpokhrel

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

Successfully merging a pull request may close this issue.

2 participants