Skip to content

Commit

Permalink
adding base environment file and index + local configuration
Browse files Browse the repository at this point in the history
adding base environment file and index + local configuration
  • Loading branch information
TarekAloch committed Nov 12, 2013
1 parent 0a62656 commit 109efb4
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
36 changes: 36 additions & 0 deletions environment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/*-------------------------------------------------------------------------------------------------
LOCAL
This is your environment file that contains configs specific to *this* environment.
Your local setup and your live setup should both have their own versions of this file.
This file should not be tracked in your Git repo.
-------------------------------------------------------------------------------------------------*/

# We're on the local environment so toggle IN_PRODUCTION off
define('IN_PRODUCTION', FALSE);

# Always display errors on local environment
define('DISPLAY_ERRORS', TRUE);

# To avoid accidentally sending a mass amount of emails to your users when testing, always disable outgoing emails on your local environment
define('ENABLE_OUTGOING_EMAIL', FALSE);

# To learn more about fakemail, goto /core/controllers/c_coreutils.php test_fakemail()
define('FAKEMAIL', FALSE);

# Toggle this based on whether you want to connect to your local DB or your live DB
define('REMOTE_DB', FALSE);

if (REMOTE_DB) {
define('DB_HOST', '');
define('DB_USER', '');
define('DB_PASS', '');

} else {
define('DB_HOST', 'localhost');
define('DB_USER', 'shankara_thought');
define('DB_PASS', 'password123');
}

# If you want to test parts of your app that behave differently based on the time, you can force the time here.
//define(MIMIC_TIME, "September 30, 2012 12:00pm");
47 changes: 47 additions & 0 deletions p2/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/*
When setting configurations, remember that any app is also impacted by the configurations found in /core/config/config.php;
Most of the core configs can be overwritten here on the app level.
For example there's a constant in core config set for TIME_FORMAT
if(!defined('TIME_FORMAT')) define('TIME_FORMAT', 'F j, Y g:ia');
If you want a different default time format for this app, set it below
define('TIME_FORMAT', 'M j Y');
*/

# What is the name of this app?
define('APP_NAME', 'UFP');

# When email is sent out from the server, where should it come from?
# Ideally, this should match the domain name
define('APP_EMAIL', '[email protected]');

/*
A email designated to receive messages from the server. Examples:
* When there's a MySQL error on the live server it will send it to this email
* If you're BCCing yourself on outgoing emails you may want them to go there
* Logs, cron results, errors, etc.
Some might want this to be the same as the APP_EMAIL, others might want to create a designated gmail address for it
*/
define('SYSTEM_EMAIL', '[email protected]');

# Default DB name for this app
define('DB_NAME', "tarekal1_dev");

# Timezone
define('TIMEZONE', 'America/New_York');

# If your app is going to have outgoing emails, you should fill in your SMTP settings
# For this you could use gmail SMTP or something like http://sendgrid.com/
define('SMTP_HOST', 'smtp.gmail.com');
define('SMTP_USERNAME', '[email protected]');
define('SMTP_PASSWORD', '');

# For extra security, you might want to set different salts than what the core uses
define('PASSWORD_SALT', 'aasdasdasdasdasdadrermvds');
define('TOKEN_SALT', 'asdad324234enfmee');
Empty file added p2/config/feature_flags.php
Empty file.
37 changes: 37 additions & 0 deletions p2/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

# The DOC_ROOT and APP_PATH constant have to happen in the actual app

# Document root, ex: /path/to/home/app.com/../ (uses ./ on CLI)
define('DOC_ROOT', empty($_SERVER['DOCUMENT_ROOT']) ? './' : realpath($_SERVER['DOCUMENT_ROOT']).'/../');

# App path, ex: /path/to/home/app.com/
define('APP_PATH', realpath(dirname(__FILE__)).'/');

# Environment
require_once DOC_ROOT.'environment.php';

# Where is core located?
define('CORE_PATH', $_SERVER['DOCUMENT_ROOT']."/../core/");

# Load app configs
require_once APP_PATH."/config/config.php";
require_once APP_PATH."/config/feature_flags.php";

# Bootstrap
require CORE_PATH."bootstrap.php";

# Routing
Router::$routes = array(
'/' => '/index', # default controller when "/" is requested
);



# Match requested uri to any routes and instantiate controller
Router::init();

# Display environment details
require CORE_PATH."environment-details.php";

?>

0 comments on commit 109efb4

Please sign in to comment.