I think the framework itself has already provided you with the way to specify environment, it has already done its best job in the cleanest way. $SERVER['HTTP_HOST'] __IS__ a context and having this kind of contextual details in the code can be troublesome some times, e.g. when it comes to troubleshooting and testing.
I don't see it as a big problem to write your own bootstrap file/class to detect your host and pick the desired environment. Yuen-Chi Lian | www.yclian.com "I do not seek; I find." - Pablo Picasso On Mon, Sep 27, 2010 at 10:41 PM, Pablo Godel <[email protected]> wrote: > You also need to keep in mind that different web servers provide different > information regarding hostname and environment. > > The way I deal with this in most cases is defining my bootstrapping file in > each server, so in dev it is index_dev.php, qa index_qa.php and prod > index.php > Most of the time you will do this in the web server config setting the > rewrite in the VirtualHost section and ignoring the .htaccess file. > > Pablo > > > On Mon, Sep 27, 2010 at 8:49 AM, Thomas Rabaix <[email protected]> wrote: > >> This is not that easy ;) >> >> This need to be ported to the console too ... maybe with a --host >> parameter ... >> >> >> On Mon, Sep 27, 2010 at 1:05 PM, Tim Nagel <[email protected]> wrote: >> >>> Sorry, but how is modifying the kernel that bootstraps an application a >>> hack? >>> >>> The kernel itself is designed that the function that gets a configuration >>> file can be customised. >>> >>> public function registerContainerConfiguration(LoaderInterface $loader) >>> { >>> >>> $loader->load(__DIR__.'/config/'.$_SERVER['HTTP_HOST'].'/config_'$this->getEnvironment().'.yml'); >>> } >>> >>> Bam. All done. (Other considerations like throwing exceptions if a host >>> config doesnt exist can also easily be added) >>> >>> >>> >>> t >>> >>> >>> >>> On Mon, Sep 27, 2010 at 20:33, Thomas Rabaix <[email protected]> wrote: >>> >>>> I mean different settings depend on your host : >>>> - dev.yoursite.com >>>> - preprod.yoursite.com >>>> - www.yoursite.com >>>> >>>> Settings can be : >>>> - database >>>> - cache handle >>>> - API key >>>> >>>> It will be great if this feature is built in inside symfony and not a >>>> hack ... >>>> >>>> On Mon, Sep 27, 2010 at 11:21 AM, Tim Nagel <[email protected]> wrote: >>>> >>>>> You can configure your own custom 'config loader' per domain by >>>>> modifying the registerContainerConfiguration function of your kernel. >>>>> >>>>> >>>>> t >>>>> >>>>> On Mon, Sep 27, 2010 at 19:18, Stefan Koopmanschap < >>>>> [email protected]> wrote: >>>>> >>>>>> what do you mean by host? like in a multi-tenant environment where an >>>>>> application can be served on multiple domains? >>>>>> >>>>>> This is relatively easy to build in yourself using routes, not sure if >>>>>> this should be in the core framework. If it's there though, I'd >>>>>> probably use it ;) >>>>>> >>>>>> On Mon, Sep 27, 2010 at 11:02 AM, Thomas Rabaix < >>>>>> [email protected]> wrote: >>>>>> > Hello, >>>>>> > One thing very frustrating with symfony 1 is there is no >>>>>> configuration per >>>>>> > host available. >>>>>> > It will be great if this feature can be built-in into the Symfony2 >>>>>> core. >>>>>> > What do you think ? >>>>>> > >>>>>> > -- >>>>>> > Thomas Rabaix >>>>>> > http://rabaix.net >>>>>> > >>>>>> > -- >>>>>> > If you want to report a vulnerability issue on symfony, please send >>>>>> it to >>>>>> > security at symfony-project.com >>>>>> > >>>>>> > You received this message because you are subscribed to the Google >>>>>> > Groups "symfony developers" group. >>>>>> > To post to this group, send email to [email protected] >>>>>> > To unsubscribe from this group, send email to >>>>>> > [email protected]<symfony-devs%[email protected]> >>>>>> > For more options, visit this group at >>>>>> > http://groups.google.com/group/symfony-devs?hl=en >>>>>> > >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Stefan Koopmanschap >>>>>> Symfony Community Manager >>>>>> [email protected] >>>>>> >>>>>> -- >>>>>> If you want to report a vulnerability issue on symfony, please send it >>>>>> to security at symfony-project.com >>>>>> >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "symfony developers" group. >>>>>> To post to this group, send email to [email protected] >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]<symfony-devs%[email protected]> >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/symfony-devs?hl=en >>>>>> >>>>> >>>>> -- >>>>> If you want to report a vulnerability issue on symfony, please send >>>>> it to security at symfony-project.com >>>>> >>>>> You received this message because you are subscribed to the Google >>>>> Groups "symfony developers" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> [email protected]<symfony-devs%[email protected]> >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/symfony-devs?hl=en >>>>> >>>> >>>> >>>> >>>> -- >>>> Thomas Rabaix >>>> http://rabaix.net >>>> >>>> -- >>>> If you want to report a vulnerability issue on symfony, please send it >>>> to security at symfony-project.com >>>> >>>> You received this message because you are subscribed to the Google >>>> Groups "symfony developers" group. >>>> To post to this group, send email to [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected]<symfony-devs%[email protected]> >>>> For more options, visit this group at >>>> http://groups.google.com/group/symfony-devs?hl=en >>>> >>> >>> -- >>> If you want to report a vulnerability issue on symfony, please send it to >>> security at symfony-project.com >>> >>> You received this message because you are subscribed to the Google >>> Groups "symfony developers" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected]<symfony-devs%[email protected]> >>> For more options, visit this group at >>> http://groups.google.com/group/symfony-devs?hl=en >>> >> >> >> >> -- >> Thomas Rabaix >> http://rabaix.net >> >> -- >> If you want to report a vulnerability issue on symfony, please send it to >> security at symfony-project.com >> >> You received this message because you are subscribed to the Google >> Groups "symfony developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected]<symfony-devs%[email protected]> >> For more options, visit this group at >> http://groups.google.com/group/symfony-devs?hl=en >> > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<symfony-devs%[email protected]> > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
