How to use unleash-server - 5 common examples

To help you get started, we’ve selected a few unleash-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kindlyops / havengrc / unleash / keycloak-auth-hook.js View on Github external
app.use('/api/admin/', (req, res, next) => {
        if (req.user) {
            next();
        } else {
            // Instruct unleash-frontend to pop-up auth dialog
            return res
                .status('401')
                .json(
                    new AuthenticationRequired({
                        path: '/unleash/api/admin/login',
                        type: 'custom',
                        message: `You have to identify yourself in order to use Unleash. 
                        Click the button and follow the instructions.`,
                    })
                )
                .end();
        }
    });
}
github kindlyops / havengrc / unleash / google-auth-hook.js View on Github external
app.use('/api/admin/', (req, res, next) => {
        if (req.user) {
            next();
        } else {
            // Instruct unleash-frontend to pop-up auth dialog
            return res
                .status('401')
                .json(
                    new AuthenticationRequired({
                        path: '/api/admin/login',
                        type: 'custom',
                        message: `You have to identify yourself in order to use Unleash. 
                        Click the button and follow the instructions.`,
                    })
                )
                .end();
        }
    });
}
github kindlyops / havengrc / unleash / index.js View on Github external
app.use('/api/admin/', (req, res, next) => {
        const email = req.get('X-Auth-Email');

        if (email) {
            // TODO: need to do some verification of credentials here, probably
            // validate X-Auth-Token signature

            const user = new unleash.User({ email: `${email}` });
            req.user = user;
            next();
        } else {
            return res
                .status('401')
                .end('access denied');
        }
    });
github kindlyops / havengrc / unleash / index.js View on Github external
});
};
options.preRouterHook = gatekeeperAuthentication;


function serveFrontend(app) {
    app.use('/', express.static('/frontend'));
}

options.preHook = serveFrontend;

if (process.env.DATABASE_URL_FILE) {
    options.databaseUrl = fs.readFileSync(process.env.DATABASE_URL_FILE);
}

unleash
    .start(options)
    .then(server => {
        console.log(
            `Unleash API started on http://localhost:${server.app.get('port')}`
        );
    });
github kindlyops / havengrc / unleash / google-auth-hook.js View on Github external
(accessToken, refreshToken, profile, done) => {
            done(
                null,
                new User({
                    name: profile.displayName,
                    email: profile.emails[0].value,
                })
            );
        }
    )

unleash-server

Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.

Apache-2.0
Latest version published 2 days ago

Package Health Score

95 / 100
Full package analysis