crimson/src/config.php

76 lines
2.3 KiB
PHP
Raw Normal View History

2024-12-23 15:39:16 +00:00
<?php
/// CRIMSON --- A simple PHP framework.
/// Copyright © 2024 Freya Murphy <contact@freyacat.org>
///
/// This file is part of CRIMSON.
///
/// CRIMSON is free software; you can redistribute it and/or modify it
/// under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 3 of the License, or (at
/// your option) any later version.
///
/// CRIMSON is distributed in the hope that it will be useful, but
/// WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with CRIMSON. If not, see <http://www.gnu.org/licenses/>.
// ENVIRONMENT
//
// devlopment - do not cache any assets
// - use http host provided by user
//
// production - use generated timestamps for each file
// - hard code http host to 'domain' lang string
//
if (!defined('ENVIRONMENT')) {
if (getenv('ENVIRONMENT') !== FALSE)
define('ENVIRONMENT', getenv('ENVIRONMENT'));
else
define('ENVIRONMENT', 'devlopment');
}
// CONFIG
// config values needed across the website
//
// domain - the default domain for the website
//
// allowed_hosts - accepted domains to use for the website
//
// base_path - the base path the website is located at
//
// theme_color - html hex color used for browser metadata
//
// routes - array of regex keys that match the request path and
// - place it with the value if it matches
// - e.g. '' => 'home' sends / to /home
//
// style - single or list of css styles to load on specific routes
//
// js - single or list of js script to load on specific routes
//
// autoload - list of directories to autoload all PHP files in them
//
define('BASE_CONFIG', array(
/* core settings */
'domain' => 'localhost',
'allowed_hosts' => ['localhost'],
'base_path' => '/',
'theme_color' => '#181818',
/* route overides */
'routes' => array(),
/* css to load on each route */
'style' => array(),
/* js to load on each route */
'js' => array(),
/* directories to autoload php code */
'autoload' => array(),
));
if (!defined('SITE_CONFIG'))
define('SITE_CONFIG', array());
define('CONFIG', array_merge(BASE_CONFIG, SITE_CONFIG));