anvilresearch / connect

A modern authorization server built to authenticate your users and protect your APIs
http://anvil.io
MIT License
361 stars 85 forks source link

Ensure writable `logs` folder on boot #305

Closed bauglir closed 8 years ago

bauglir commented 8 years ago

If the logs folder is not available the server will boot up fine, but crash as soon as a log entry is made.I think it's probably better to crash as soon as possible.

I did use the asynchronous versions of stat and access here, which may cause server boot to be aborted while it's doing other things. I'm not exactly sure if this could actually happen though nor that if it did whether that'd be harmful.

Any input on that is welcome. I can always switch the logic out of the synchronous versions. I don't think keeping the asynchronous version and only setting up the export when the logs folder has been verified would work.

Another solution of course would be to add the logs folder to the repository itself, but I'm leaning toward creating it if necessary to keep the repository clear of 'empty' folders.

christiansmith commented 8 years ago

Good work. We'll refactor this for testing in a separate piece of work. Thanks!

bauglir commented 8 years ago

I'll take care of refactoring that out and adding some tests. That should bring the coverage back up over 80% (I hope :smile:)