Closed mighe closed 9 years ago
Here the first implementation, but I think there's still a inconsistency:
public_dir 'my_dir'
returns [ root/my_dir ]
, making hard to do something like
public_dir( ['other_dir'] + public_dir)
to prepend a new folder.
Any ideas? :smile_cat:
hrm, seems pretty complex. i don't think sinatra does this? maybe something like symlinks can work?
i have an angelo app running behind nginx and nginx is configured to serve "public" files so that the request doesn't even hit the angelo app - i imagine nginx could serve more than one with a bit more config... but you probably have a different environment.
can you help me understand the requirements a bit better?
Our app will be deployed in many systems, sharing a great number of html and js files; every system could have "custom" files, for example a css that "overrides" the default one or a different html view. The idea is to keep the common files in a directory and the custom ones in another directory.
Probably you're right: I could use Angelo to manage websockets and the api, while serving static files with another server, without screwing up Angelo for a very specific scenario like mine.
@mighe see recent issue about sinatra-multiroute and thoughts of "angelo-contrib"; if this is something you think would be a good fit as a plugin, go ahead and reopen.
I need to serve static files from two different folders.
Here is my idea:
public_dir
accepts also an Array of paths, for examplepublic_dir ['html/public', 'secret_folder']
html/public
it will be servedsecret_folder
it will be servedThe biggest issue is that the method
public_dir
, when used as an accessor, has to return an array: to solve it I'd implement a couple of new methods calledsend_public_file(file_name)
andpublic_file?(file_name)
, that way it's unlikely that a user will usepublic_dir
directly in his/her code.What do you think? Since I need it I'm going to implement it immediately, if you think it is a valuable feature you will have a pull request in a couple of days