diff options
author | Freya Murphy <freya@freyacat.org> | 2024-12-23 10:39:16 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-12-23 10:39:16 -0500 |
commit | de9cae795f93d03e68d965c59af4b21d96df4ec7 (patch) | |
tree | ad4f903c04630b3b92e2b9b5d06d5b8647d299bb /src/config.php | |
parent | license (diff) | |
download | crimson-de9cae795f93d03e68d965c59af4b21d96df4ec7.tar.gz crimson-de9cae795f93d03e68d965c59af4b21d96df4ec7.tar.bz2 crimson-de9cae795f93d03e68d965c59af4b21d96df4ec7.zip |
initial
Diffstat (limited to 'src/config.php')
-rw-r--r-- | src/config.php | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/config.php b/src/config.php new file mode 100644 index 0000000..0d52d96 --- /dev/null +++ b/src/config.php @@ -0,0 +1,75 @@ +<?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)); |