mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-22 12:44:25 +00:00
auto-init environment configuration file
This commit is contained in:
parent
6ac3a1590b
commit
e9adc780ad
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
/src/config/*.php
|
/src/config/*.php
|
||||||
!/src/config/bootstrap.php
|
!/src/config/bootstrap.php
|
||||||
!/src/config/env.default.php
|
!/src/config/env.example.php
|
||||||
|
|
||||||
/src/public/api/manifest.json
|
/src/public/api/manifest.json
|
||||||
/src/public/api/users.json
|
/src/public/api/users.json
|
||||||
|
@ -3,19 +3,29 @@
|
|||||||
// PHP
|
// PHP
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
// Environment
|
// Init environment
|
||||||
if (!empty($_SERVER['PHP_ENV']) && file_exists(sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV'])))
|
if (empty($_SERVER['PHP_ENV']))
|
||||||
{
|
{
|
||||||
require_once sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV']);
|
$_SERVER['PHP_ENV'] = 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
else require_once __DIR__ . '/env.default.php';
|
// Generate configuration file if not exists
|
||||||
|
if (!file_exists(sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV'])))
|
||||||
|
{
|
||||||
|
copy(
|
||||||
|
__DIR__ . '/env.example.php',
|
||||||
|
sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Autoload
|
// Load environment configuration
|
||||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
require_once sprintf('%s/env.%s.php', __DIR__, $_SERVER['PHP_ENV']);
|
||||||
|
|
||||||
// Local
|
// Local internal dependencies
|
||||||
require_once __DIR__ . '/../library/database.php';
|
require_once __DIR__ . '/../library/database.php';
|
||||||
require_once __DIR__ . '/../library/sphinx.php';
|
require_once __DIR__ . '/../library/sphinx.php';
|
||||||
require_once __DIR__ . '/../library/scrapeer.php';
|
require_once __DIR__ . '/../library/scrapeer.php';
|
||||||
require_once __DIR__ . '/../library/time.php';
|
require_once __DIR__ . '/../library/time.php';
|
||||||
|
|
||||||
|
// Vendors autoload
|
||||||
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
@ -23,10 +23,6 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*
|
*
|
||||||
* Default configuration file
|
|
||||||
*
|
|
||||||
* For different environments, use separated env.NAME.php files
|
|
||||||
*
|
|
||||||
* Project home page
|
* Project home page
|
||||||
* https://github.com/YGGverse/YGGtracker
|
* https://github.com/YGGverse/YGGtracker
|
||||||
*
|
*
|
Loading…
x
Reference in New Issue
Block a user