birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
135 stars 21 forks source link

Set custom Lighttpd configuration file #72

Closed pliusnin closed 10 months ago

pliusnin commented 11 months ago

Seems like it's not possible to set up server with custom configuration. Would you able to extend server config with ability to define lighttpd config file?

birdofpreyru commented 11 months ago

Yeah, the idea to allow for a custom Lighttpd config, I have it for a while (see #13). To do it correctly, it requires some re-design of the existing API... I think splitting current Server class implementation into two, one BaseServer which works with an arbitrary config file, and then Server class extending it, with all methods and stuff that rely on the actual config content. But then... if one wants a custom config, I presume he also wants to use additional Lighttpd modules, so it requires to check these modules can be build for target platforms and opted-in to be used; it requires documentation updates; and thus it starts to feel as a big undertaking... which I can perfectly do if somebody funds it, but otherwise I don't need it myself for my ongoing goals, thus don't see me investing my own resources into working on it otherwise.

An easier alternative, if small additions / alterations in the current config work for you, we can expose them through some additional options of Server constructor. Similar to how I did to rapidly allow for opting-in for WebDAV module in the last release.

gstrauss commented 11 months ago

Aside: Regarding the current config: lighttpd 1.4.71 provides some common values by default for mimetype.assign, if not specified (https://github.com/lighttpd/lighttpd1.4/commit/532a3c06bccce39920fe2801467ca82caa7fdb4b), and lighttpd 1.4.72 will expand that a bit (https://github.com/lighttpd/lighttpd1.4/commit/854503631ddcc1d6636dce8e11d46111ba5e8bed).

In the vein of simpler configs, you might want to review what lighttpd now provides and consider removing your overwrite in the current config

birdofpreyru commented 10 months ago

@pliusnin: On a second thought, in v0.9.0 I just added extraConfig option to Server constructor, which allows to append arbitrary Lighttpd configuration to the base one created by the library.

pliusnin commented 10 months ago

Thanks @birdofpreyru , I'll check it out a bit later 👍