cyrusimap / cassandane

Other
6 stars 11 forks source link

Look for cassandane.ini in more places, give up if it's missing #177

Closed elliefm closed 2 years ago

elliefm commented 2 years ago

This will become more important once cassandane is merged into the cyrus repo.

The main practical outcome here is that you can keep your cassandane.ini in your home directory, rather than in the repo (where's it's vulnerable to being wiped by a git clean), though you can still keep it in the repo if you want. You can now also call it ".cassandane.ini" if you like.

It's a little more complicated than you'd think it needs to be because become_cyrus() usually re-execs the script with sudo -u cyrus, and sudo sets both the real and effective uids, so you also need to check $SUDO_UID to find out who the process really belongs to. I didn't want to have to put my cassandane.ini in cyrus's home directory (cause that's annoying to edit), nor assume the cyrus user even has a home directory, but if it does and there's a cassandane.ini file there it will use it. If not, it will look in your home directory next.

I've also never seen Cassandane successfully run without a cassandane.ini file, so I made it just die with an error if it's missing, instead of naively trying to run with pure defaults and every test failing.

Also fixed a little quirk with how the --rerun and --config options are handled, and fixed a bunch of places where the Cassandane::Cassini->instance() class method was being invoked incorrectly (albeit with no ill effect)