Browse Source

move default config inline, check for config file before loading

this allows you to use XRay without creating a config file using its default settings (currently only caching disabled)
pull/39/head
Aaron Parecki 4 years ago
parent
commit
e9b044aa7c
No known key found for this signature in database GPG Key ID: 276C2817346D6056
4 changed files with 10 additions and 4 deletions
  1. +0
    -1
      composer.json
  2. +0
    -1
      config.production.php
  3. +0
    -1
      config.template.php
  4. +10
    -1
      public/index.php

+ 0
- 1
composer.json View File

@ -9,7 +9,6 @@
},
"autoload": {
"files": [
"config.php",
"lib/helpers.php",
"controllers/Main.php",
"controllers/Parse.php",

+ 0
- 1
config.production.php View File

@ -1,5 +1,4 @@
<?php
class Config {
public static $base = 'https://xray.p3k.io';
public static $cache = true;
}

+ 0
- 1
config.template.php View File

@ -1,5 +1,4 @@
<?php
class Config {
public static $base = 'http://example.com';
public static $cache = false;
}

+ 10
- 1
public/index.php View File

@ -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;

Loading…
Cancel
Save