← Back to team overview

dhis2-devs team mailing list archive

Re: dhis lite

 

>
> > Sorry obviously that won't be enough. DHIS 2 looks for config file in
> this
> > order: 1) default properties file in dhis-support-hibernate 2) Classpath
> in
> > the WAR 3) DHIS2_HOME env variable, where the last one gets precedence.
> We
> > could read in a hibernate.properties file and overwrite a file on the
> > classpath inside the WAR. But that won't be extremely elegant.
> Alternatively
> > we could modify DHIS 2 to look for a system property dhis2.home and use
> the
> > get/setProperty methods.
> >
>
> I think a system property (eg dhis2.home) is an excellent idea - much
> prefer them to environment variables.  It might also provide some
> flexibility for those who are deploying multiple dhis2 applications on
> a single server machine as we saw in India. I'm pretty sure we could
> then put the properties file in the jar though it seems reasonable to
> have the configurable bits outside and easily editable. Though a mixed
> blessing I know ...


OK. I think we need to keep the environment variable in addition since

- system properties are Java-specific and I guess the only way to set it
outside Java is through -D options to the java command line (?) for use with
standard databases.
- we would have to update all existing installations if we remove it...


>
>
> I wonder if we might make a slight improvement to startup time while
> we're at it.  Currently it seems the DHIS hibernate sub-system looks
> for all those locations before finally deciding to use the latter.
> Can we do the search in the reverse order - ie if dhis2.home property
> is set, check for hibernate.properties, use that and get straight on
> with the rest of the busy tasks of initialisation.  On my system that
> will shave off 2 or 3 seconds.
>
>
A problem with this is that it's handy to have the files overriding each
other as the default properties contains more information than what the
"DHIS2_HOME one" usually does, like connection pooling and caching. But we
could say that if the DHIS2 system property is set, we could skip looking
for the DHIS2 environment variable?

System.getProperty( "user.dir" ) will give you the current working
directory.

So we have a hibernate.properties in or inline with the exe jar which looks
up its cwr, sets a dhis2.home system property with this value, starts the
webapp and lets dhis2 read it in...?

Follow ups

References