timvisee / lazymc

💤 Put your Minecraft server to rest when idle.
GNU General Public License v3.0
573 stars 15 forks source link

Add some sort of "wake up" whitelist #12

Closed dschemp closed 2 years ago

dschemp commented 2 years ago

Hi, it would be nice if not everyone could start up the server. In my case I would have to start quite a big modpack server just to then tell the user that they are not allowed to join. This would keep resources free as long as "actual" users try to wake the server up. I could imagine an option like "use_server_whitelist" or "use_custom_whitelist" with manual entries (e.g. the server does not use a whitelist but waking up should be limited to certain users; don't know if this is sensible or not).

Thank you very much.

timvisee commented 2 years ago

use_server_whitelist is definitely something nice to implement.

Would using the server whitelist be 'good enough' for now?

dschemp commented 2 years ago

Yeah. I think this would suffice for now.

timvisee commented 2 years ago

I'll try to implement this in one or two days.

timvisee commented 2 years ago

I've added wake_whitelist which defaults to true. It uses the server whitelist to determine whether a user is allowed to connect, if the whitelist is enabled on the server.

Technical note: it only prevents users from waking the server, and doesn't prevent connections when the server is already started. This shouldn't be a problem, as the Minecraft server itself will enforce the whitelist as well.

I've released this as part of v0.2.6. Updating the binary should be enough.