Permalink
Browse files

Updated config to use Environments

  • Loading branch information...
1 parent 74366e8 commit ef70e0390f1c5f5257e0f40db12b11983e5873a4 @hermanbanken committed May 14, 2012
Showing with 97 additions and 37 deletions.
  1. +8 −3 app/bootstrap.default.php
  2. +28 −6 app/config/4sq.php
  3. +61 −28 app/config/database.default.php
@@ -51,9 +51,14 @@
/**
* Set environment
*/
-if(!isset($_SERVER['KOHANA_ENV']))
- $_SERVER['KOHANA_ENV'] = ":environment";
-
+if(Kohana::$server_name == "cultuurapp.nl")
+ $_SERVER['KOHANA_ENV'] = "PRODUCTION";
+elseif(Kohana::$server_name == "dev.cultuurapp.nl")
+ $_SERVER['KOHANA_ENV'] = "DEVELOPMENT";
+elseif(!isset($_SERVER['KOHANA_ENV'])){
+ $env = ":environment";
+ $_SERVER['KOHANA_ENV'] = !empty($env) ? $env : "STAGING";
+}
// -- Configuration and initialization -----------------------------------------
/**
View
@@ -1,7 +1,29 @@
<?php
-return array(
- 'client' => array(
- 'id' => '3O2Z2ECV0LDXKV3A0SR2FCLIPPQRFDY4QOXNKAXWMGB0WSOA',
- 'secret' => 'OGA5RRPQTYVKXMMK5YWFL5IYT5T13NVGHXHDMQEE30AMNHDD',
- ),
-);
+
+if (Kohana::$environment == Kohana::PRODUCTION)
+{
+ return array(
+ 'client' => array(
+ 'id' => '3O2Z2ECV0LDXKV3A0SR2FCLIPPQRFDY4QOXNKAXWMGB0WSOA',
+ 'secret' => 'OGA5RRPQTYVKXMMK5YWFL5IYT5T13NVGHXHDMQEE30AMNHDD',
+ ),
+ );
+}
+elseif (Kohana::$environment == Kohana::DEVELOPMENT)
+{
+ return array(
+ 'client' => array(
+ 'id' => '3O2Z2ECV0LDXKV3A0SR2FCLIPPQRFDY4QOXNKAXWMGB0WSOA',
+ 'secret' => 'OGA5RRPQTYVKXMMK5YWFL5IYT5T13NVGHXHDMQEE30AMNHDD',
+ ),
+ );
+}
+elseif (Kohana::$environment == Kohana::STAGING)
+{
+ return array(
+ 'client' => array(
+ 'id' => 'G4B4ZQ0C3QYJRJFPF3WH4TLKSDGXREGWMQCCJV3DNMUGZ0U3',
+ 'secret' => 'I51O0ICTYPH44S5FBGNDRJYHMPBAILTWNFBCOR0OBIMKAK5O',
+ )
+ );
+}
@@ -1,32 +1,65 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
-return array
-(
- 'default' => array
+if (Kohana::$environment == Kohana::PRODUCTION)
+{
+ return array
(
- 'type' => 'mysql',
- 'connection' => array(
- /**
- * The following options are available for MySQL:
- *
- * string hostname server hostname, or socket
- * string database database name
- * string username database username
- * string password database password
- * boolean persistent use persistent connections?
- * array variables system variables as "key => value" pairs
- *
- * Ports and sockets may be appended to the hostname.
- */
- 'hostname' => ':hostname',
- 'database' => ':database',
- 'username' => ':username',
- 'password' => ':password',
- 'persistent' => FALSE,
+ 'default' => array
+ (
+ 'type' => 'mysql',
+ 'connection' => array(
+ 'hostname' => 'localhost',
+ 'database' => 'cultuur',
+ 'username' => 'cultuur',
+ 'password' => '',
+ 'persistent' => TRUE,
+ ),
+ 'table_prefix' => 'live_',
+ 'charset' => 'utf8',
+ 'caching' => TRUE,
+ 'profiling' => FALSE,
),
- 'table_prefix' => 'dev_',
- 'charset' => 'utf8',
- 'caching' => FALSE,
- 'profiling' => TRUE,
- ),
-);
+ );
+}
+elseif (Kohana::$environment == Kohana::DEVELOPMENT)
+{
+ return array
+ (
+ 'default' => array
+ (
+ 'type' => 'mysql',
+ 'connection' => array(
+ 'hostname' => 'localhost',
+ 'database' => 'cultuur',
+ 'username' => 'cultuur',
+ 'password' => '',
+ 'persistent' => TRUE,
+ ),
+ 'table_prefix' => 'dev_',
+ 'charset' => 'utf8',
+ 'caching' => FALSE,
+ 'profiling' => TRUE,
+ ),
+ );
+}
+else
+{
+ return array
+ (
+ 'default' => array
+ (
+ 'type' => 'mysql',
+ 'connection' => array(
+ 'hostname' => ':hostname',
+ 'database' => ':database',
+ 'username' => ':username',
+ 'password' => ':password',
+ 'persistent' => FALSE,
+ ),
+ 'table_prefix' => 'dev_',
+ 'charset' => 'utf8',
+ 'caching' => FALSE,
+ 'profiling' => TRUE,
+ ),
+ );
+}

0 comments on commit ef70e03

Please sign in to comment.