kerberos-io / web

(DEPRECATED) An open source GUI to configure the machinery and to view events that were detected by the machinery.
https://www.kerberos.io
226 stars 69 forks source link

parameter disk->path in app.php can't be changed at all #37

Closed Orabig closed 8 years ago

Orabig commented 8 years ago

This parameter is defined like this :

        'disk' => [
            'path' => '/capture/',
        ],

but this can't be changed at all. -> The final '/' is mandatory, because the image filenames are directly concatenated to it. -> The leading '/' is mandatory too, for the same reason -> This path is relative to <WEB-ROOT>/public so it's impossible to set it as '/var/capture' (for instance)

Orabig commented 8 years ago

I would love to tell that this path is absolute iif it's starting with '/', but unfortunately, this would break the current configuration of the users (as it has been defined as /capture/ by default).

What do you think ?

cedricve commented 8 years ago

The path can't be absolute, because it needs to be relative to the location of the webserver. When e.g. Nginx is configured to look at the PHP project at /var/www/web. Then you're fixed to that directory, otherwise the images can't be rendered in the browser.

To solve that particular problem, I came up with the symbol link thing. What we'll need to do is add an extra check in to source, to confirm the symbol link exists and if it does we also need to check if the directory to which it is pointing also exists.

Orabig commented 8 years ago

Yes, you're right. It can't be anywhere else than under /public/ I will do some testing about symlinks. I think I had issues with it yesterday, but I pretty sure I can make it work that way.

Anyway, the final / should definitively not be mandatory

cedricve commented 8 years ago

Yes, we'll need to change some code in the Filesystemhandler. Pretty easy-one to be honest: https://github.com/kerberos-io/web/blob/master/app/repositories/filesystem/DiskFileSystem.php#L19.

We should add the "/" if it's not there in the disk path.