Re: build dist replacement

Jean-Christophe Michel <jc.michel-/aRvmaKoZxNWk0Htik3J/[email protected]> Wed, 09 Mar 2005 19:15:08 +0100
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
alex black wrote:
> my solution to this, after much thinking, is not to allow it.
> 
> If you want to detect that a system is in 'development' mode - you 
> should write code to do that and change conf settings accordingly.
> 
> I found _many_ times with berkeleymedia I confused the dev and dist conf 
> files, and displayed debug info on the production site, etc.
> 
> Also if you look at the conf differences between deb and prod they are 
> usually miniscule (smarty console, debug, bits of DB config) so it's not 
> much code :)

True. But it's heavy to extend Project for this. Couldn't we reverse the 
design: normal conf should be production one, and exception is "dev". We 
could have a conf value in binarycloud.conf.xml to define the 'dev' 
machine with either an ip 192.168.x.y (which cannot be on a public 
machine) or a host name, and have Conf *set* the conf value "is_dev"
and load an additional dir to override values if dev:

binarycloud.conf.xml
    <section name="is_dev">
       <param name="if_host">myname.example.com</param>
    </section>

or directly
    <param name="is_dev" type="boolean">true</param>

Conf :
    // load binarycloud.com
...
    $is_dev = $this->configuration[BC_CONF_FACTORY] \
                                   ['binarycloud']['is_dev'];
    if ($id_dev !== true) {
       if ($is_dev['if_host'] == $_SERVER['HOSTNAME']) {
           Conf->setConf('/binarycloud/is_dev', true);
           $this->configuration[BC_CONF_FACTORY] \
                                   ['binarycloud']['is_dev'] = true:
       }
    }
    if ($is_dev && file_exists($confdir . '/development.conf.xml')) {
       //load it
    }


-- 
Jean-Christophe Michel
_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev