Skip to content

Commit

Permalink
move default config inline, check for config file before loading
Browse files Browse the repository at this point in the history
this allows you to use XRay without creating a config file using its default settings (currently only caching disabled)
  • Loading branch information
aaronpk committed Jan 11, 2017
1 parent 876d469 commit e9b044a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion composer.json
Expand Up @@ -9,7 +9,6 @@
},
"autoload": {
"files": [
"config.php",
"lib/helpers.php",
"controllers/Main.php",
"controllers/Parse.php",
Expand Down
1 change: 0 additions & 1 deletion config.production.php
@@ -1,5 +1,4 @@
<?php
class Config {
public static $base = 'https://xray.p3k.io';
public static $cache = true;
}
1 change: 0 additions & 1 deletion config.template.php
@@ -1,5 +1,4 @@
<?php
class Config {
public static $base = 'http://example.com';
public static $cache = false;
}
11 changes: 10 additions & 1 deletion public/index.php
@@ -1,9 +1,18 @@
<?php
chdir('..');
chdir(dirname(__FILE__).'/..');
include('vendor/autoload.php');

register_shutdown_function('shutdown');

// Load config file if present, otherwise use default
if(file_exists(dirname(__FILE__).'/../config.php')) {
require 'config.php';
} else {
class Config {
public static $cache = false;
}
}

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$router = new League\Route\RouteCollection;
Expand Down

0 comments on commit e9b044a

Please sign in to comment.