Reputation: 678
Hi i need the codeigniter encryption library encryption key to set form external file because i dont want this to set in config.php file because of security.
$config['encryption_key'] = 'my_key';
Upvotes: 0
Views: 358
Reputation: 1700
You can use Loading custom config file :-
After create custom config file we need to load it get it’s items. for load custom config we have two ways.
Manual loading :- we can manual load config file in controller/model like
$this->config->load('file_name'); //or use custom_config instead of file_name
where “file_name” is your custom config file name without .php extension.
Autoloading :- for auto load config file go to “application/config/autoload.php” and add code in $autoload[‘config’]
$autoload['config'] = array('config_custom'); //where config_custom is your file name.
Upvotes: 1
Reputation: 6994
Make a new config file application/config/config1.php
.with
$config['encryption_key'] = 'my_key';
Now load it form application/config/autoload.php
as below:
$autoload['config'] = array('config1');
Upvotes: 0