Created
April 29, 2017 15:49
-
-
Save lvl99/86fa5416dbdb9f374411390bb0f53ef3 to your computer and use it in GitHub Desktop.
Vanilla ForumsHow one can support multiple configuration options depending on the server/hostname/etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Detect any specific server environment config setup to apply | |
// Default: development | |
$server_environment = 'development'; | |
if ( ! empty( $_SERVER['HTTP_SERVER_ENVIRONMENT'] ) ) { | |
$server_environment = $_SERVER['HTTP_SERVER_ENVIRONMENT']; | |
} | |
// Load the server environment config | |
$env_config_path = PATH_CONF . '/config-' . $server_environment . '.php'; | |
if ( ! empty( $_SERVER['HTTP_SERVER_ENVIRONMENT'] ) && file_exists( $env_config_path ) ) { | |
Gdn::Config()->Load( $env_config_path, 'Configuration', TRUE ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('APPLICATION')) exit(); | |
// Database | |
$Configuration['Database']['Name'] = 'example_forums_development'; | |
$Configuration['Database']['Host'] = 'localhost'; | |
$Configuration['Database']['User'] = 'root'; | |
$Configuration['Database']['Password'] = 'root'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('APPLICATION')) exit(); | |
// Database | |
$Configuration['Database']['Name'] = 'example_forums'; | |
$Configuration['Database']['Host'] = 'mysql.example_forums.com'; | |
$Configuration['Database']['User'] = 'example_forums'; | |
$Configuration['Database']['Password'] = 'asdf1234!@#$'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('APPLICATION')) exit(); | |
// Database | |
$Configuration['Database']['Name'] = 'example_forums_staging'; | |
$Configuration['Database']['Host'] = 'mysql.example_forums.com'; | |
$Configuration['Database']['User'] = 'example_forums'; | |
$Configuration['Database']['Password'] = 'asdf1234!@#$'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment