WriteOn / WriteOnApp

On a mission to create the world's finest writing experience.
https://writeon.io
Apache License 2.0
1 stars 0 forks source link

API Middleware Config #38

Closed thinq4yourself closed 9 years ago

thinq4yourself commented 9 years ago

With 1.9.x, The Tumblr, Github and Wordpress middleware configs are reliant on the local config json or ENV variable. However, this has already caused problems after forgetting to reset the config json keys to the correct ENV, and the ENV variables not being set caused the next.* app to use the wrong oAuth app.

To fix this, I created 3 json configs, default, next, and dev. The a switch to pull in the correct json config for that environment.

var configJson = '/config/tumblr.json';

    app.use('*', function(req, res, next) {
        if (req.hostname == 'mammal-charter.codio.io') {
            configJson = '/config/tumblr.dev.json';
        }
        else if (req.hostname == 'next.writeon.io') {
            configJson = '/config/tumblr.next.json';
        }
    });

Needs full testing in Dev and Next before proceeding.

thinq4yourself commented 9 years ago

Done in 1.9.29