How to use the webiny-entity.Entity.driver function in webiny-entity

To help you get started, we’ve selected a few webiny-entity 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 webiny / webiny-js / packages / webiny-api / src / lambda / lambda.js View on Github external
const requestSetup = async (config: Object = {}) => {
    // Configure Entity layer
    if (config.entity) {
        Entity.driver = config.entity.driver;
        Entity.crud = config.entity.crud;
    }

    // Check if connection is valid and if Settings table exists - this will tell us if the system is installed.
    if (process.env.NODE_ENV === "development") {
        try {
            await Entity.getDriver().test();
        } catch (e) {
            throw Error(
                `The following error occurred while initializing Entity driver: "${
                    e.message
                }". Did you enter the correct database information?`
            );
        }
    }
};
github webiny / webiny-js / packages / webiny-api-security / src / install / plugins / index.js View on Github external
install: async context => {
        const { config } = context;

        // Configure Entity layer
        if (config.entity) {
            Entity.driver = config.entity.driver;
            Entity.crud = config.entity.crud;
        }

        await importData(context);
    }
};