n7tae / smart-group-server

A smart routing server (STARnet Group) especially for QuadNet
GNU General Public License v2.0
4 stars 4 forks source link

Use example.cfg as default config, do not overwrite existing config #3

Closed F4FXL closed 6 years ago

F4FXL commented 6 years ago

If sgs.cfg was not created make install would fail. This fixes this by using example.cfg as default config file. This also prompts the user in case the file already exists.

spynappels commented 6 years ago

It might be better to check for the existence of sgs.cfg in the build directory first, copy if it exists and copy the example.cfg if it does not. There may be an issue if multiple servers are spun up and use the same example.cfg, as there would then be multiple sgs running with the same (incorrect) config, so using the example.cfg may cause as many problems as it solves. It might be worth looking at running an interactive script to build a valid sgs.cfg if there isn't one present, rather than copying the example.cfg.

F4FXL commented 6 years ago

I can se the point here, but since the service files only looks for /usr/local/etc/sgs.conf I thought I go for this one. IMHO just do nothing in case sgs.conf does not exist in the build directory would be best.

n7tae commented 6 years ago

No, I don't want it installed if the user hasn't created the sgs.cfg file. It's the first thing I mention in the Configuring section of the README.md. I'll move the sgs.cfg copy to the first like of install.

I'd like to build in smarts so that if a configured group already exists on QuadNet, the install would fail, but I'm not sure how to proceed...