CodeIgniter Forums
Separating Config Directory from Application? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Separating Config Directory from Application? (/showthread.php?tid=33916)

Pages: 1 2


Separating Config Directory from Application? - El Forum - 09-16-2010

[eluser]JasonS[/eluser]
Hi Bas, that sounds like exactly what I am after. Thanks a lot. I will give it a go when I finally complete my app.


Separating Config Directory from Application? - El Forum - 09-16-2010

[eluser]Bas Vermeulen[/eluser]
You're welcome, glad I could help out Smile


Separating Config Directory from Application? - El Forum - 10-13-2010

[eluser]old_guy[/eluser]
I have a similar need and I'm curious as to how you set up the user log-in to the individual sites?


Separating Config Directory from Application? - El Forum - 10-13-2010

[eluser]Bas Vermeulen[/eluser]
If you use this setup to deploy two different sites, with different databases you should be able to use w/e kind of login/auth system you want to, it really doesn't matter.

With my setup I made it possible to deploy a front-end (FE) and a back-end (BE) from the same application, using the same database with different database users (the back-end user has some more permissions). Instead of defining DB_GROUP I define DEPLOYMENT_TYPE in my index files. Then, I have two session tables (cms_sessions_FE & cms_sessions_BE) and two login tables (cms_logins_FE & cms_logins_BE) in my database. In my config.php I set which session table should be used:

Code:
$config['sess_cookie_name']        = 'ci_session_'.DEPLOYMENT_TYPE;
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']        = 'cms_sessions_'.DEPLOYMENT_TYPE;
$config['sess_match_ip']        = TRUE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;

My logins are set in the table 'cms_logins_'.DEPLOYMENT_TYPE

With this setup I can run both deployments, from one database with separated logins using the same users table. The BE deployment ofc got some extra checks to let only admin users login.