Skip to content

Configuration Providers

Jason Strimpel edited this page Aug 30, 2014 · 3 revisions

Lazo has a configuration provider, LAZO.config, with a JSON implementation that can be added as a provider, which fetches JSON from server. You can add as many providers as you like.

define(['lazoApp'], function (LazoApp) {

    'use strict';

    return LazoApp.extend({

        initialize: function (callback) {
            var jsonPlugin = new LAZO.config.JSONPlugin({

                file: 'app/env.json',

                // called up on construction
                success: function () {
                    callback();
                },

                error: function (err) {
                    LAZO.logger.error('[app.initialize] Could not load env config', err);
                    callback();
                }

            });

            LAZO.config.addPlugin(jsonPlugin);
        }

    });

});