public function bootstrap(Application $app)
    {
        // Workaround for CLI and URL based in subdirectory
        if ($app->runningInConsole()) {
            $app['url']->forceRootUrl($app['config']->get('app.url'));
        }

        // Register singletons
        $app->singleton('string', function () {
            return new \Igniter\Flame\Support\StrHelper;
        });

        // Change extensions and themes paths based on config
        if ($extensionsPath = $app['config']->get('system.extensionsPath'))
            $app->useExtensionsPath($extensionsPath);

        if ($themesPath = $app['config']->get('system.themesPath'))
            $app->useThemesPath($themesPath);

        if ($assetsPath = $app['config']->get('system.assetsPath'))
            $app->useAssetsPath($assetsPath);

        // Set execution context
        $requestPath = $this->normalizeUrl($app['request']->path());
        $adminUri = $this->normalizeUrl($app['config']->get('system.adminUri', 'admin'));
        $app->setAppContext(starts_with($requestPath, $adminUri) ? 'admin' : 'main');
    }