Stephan,

You can have multiple configurations using Zend_Config, then you just need a
way to tell which section to load. There are many ways to do that. For
example checking an existence of a file. I recently deployed a ZF project
and I look for a 'production' file, if it's missing I load a staging config.
If the file is outside of the app dir you can overwrite it completely or
move and will still work like magic ;)

The configuration file will look like this

[production]
db.type     = PDO_MYSQL
db.host     = 10.1.1.3
db.username = username
db.password = password
db.name     = dbname
db.profile      = 0
debug           = 0

[staging : production]
db.host     = 10.1.1.2
db.profile      = 1
debug           = 1

Cheers
Karol


Stephan Stapel wrote:
> 
> Hi!
> 
> I guess a lot of you have the problem to have code that is used within 
> multiple environments, a (local) environment for development, another 
> for testing and a third for production.
> 
> Usually, some things like database configuration differ between these 
> environments. I was asking myself if anyone has a smart solution for a 
> flexible configuration such that no additional files have to be renamed/ 
> moved when deploying.
> 
> If someone has a good solution, would he/she like to share it?
> 
> Regards,
> 
> Stephan
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Deployment-dependent-code-tf3977170s16154.html#a11290931
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to