Frage

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

War es hilfreich?

Lösung

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 !!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top