Вопрос

I want to set in my bootstrap the right config I will use functions of the environment. I try to use

Database::instance('my_conf');

or

Kohana::$config->attach(new Config_File('config/'.$environment));

This isn't working....

Any idea ?

Kohana version: 3.3

Это было полезно?

Решение

1 - In your bootstrap, after loading Model module, write:

Kohana::$config->attach(new Config_File('config/'.$_SERVER['YOUR_ENV']));

2 - Create in folder config a subfolder "foobar" of the name $_SERVER['YOUR_ENV']

3 - Put in it your file > config/foobar/database.php | don't change "default" key

return array
(
    'default' => array
    (
        // your config
    )
)

4 - Set in apache :

SetEnv YOUR_ENV foobar

And it works !!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top