divshot/superstatic — pull request #55 by kylemac (2014-03-29 23:26:55+00:00)
Title: expose auth to superstatic.json

I don't really expect this to be merged, as I imagine you guys have a good reason you handle it this way but I thought rather then just a simple feature request - I could actually implement it, since you guys so excellently make this project open source and it could be a discussion point.

Anyways, I thought it would be great to have basic auth built into the `superstatic.json` configuration and when I dug around, I found that you guys were already running some basic auth middleware. From what I gather, there is an .env.json file that gets read with some basic auth info. This doesn't seem to be documented so I wasn't 100% on the implementation but I think this would be a really nice feature to superstatic if it was exposed and documented.

I went ahead and adjusted the `protect.js` middleware to look for configuration.auth for it's username/password. Now you can define this directly in your `superstatic.json` file.

```json
{
"clean_urls": true,
"auth": "username:password"
}
```
Apologies, that the diffs come through a little fuzzy due to some whitespace updates that atom seemed to do...