diff --git a/boot.php b/boot.php new file mode 100644 index 0000000..f5c2de8 --- /dev/null +++ b/boot.php @@ -0,0 +1,16 @@ +set('git', 'repositories', rtrim($config->get('git', 'repositories'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR); + +// Startup and configure Silex application +$app = new GitList\Application($config, __DIR__); + +// Mount the controllers +$app->mount('', new GitList\Controller\MainController()); +$app->mount('', new GitList\Controller\BlobController()); +$app->mount('', new GitList\Controller\CommitController()); +$app->mount('', new GitList\Controller\TreeController()); + +return $app; \ No newline at end of file diff --git a/index.php b/index.php index 1ae2e04..234ab84 100644 --- a/index.php +++ b/index.php @@ -6,18 +6,5 @@ */ require 'vendor/autoload.php'; - -// Load configuration -$config = new GitList\Config('config.ini'); -$config->set('git', 'repositories', rtrim($config->get('git', 'repositories'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR); - -// Startup and configure Silex application -$app = new GitList\Application($config, __DIR__); - -// Mount the controllers -$app->mount('', new GitList\Controller\MainController()); -$app->mount('', new GitList\Controller\BlobController()); -$app->mount('', new GitList\Controller\CommitController()); -$app->mount('', new GitList\Controller\TreeController()); - -$app->run(); +$app = require 'boot.php'; +$app->run(); \ No newline at end of file