On 10/15/13, Saint Germain <[email protected]> wrote: > On Tue, 15 Oct 2013 17:07:13 -0500, Olemis Lang <[email protected]> > wrote : >> > I'm attempting to create what I believe should be a very simple Trac >> > plugin. All I want to do is set the database string from an >> > environmental variable. >> > >> > I've been playing around with this for a bit now, and I can't >> > figure out the way I ought to do this. >> > >> > I'm under the impression that I want to do something like the >> > following: >> > >> > self.config.set('trac', 'database', os.environ.get('DATABASE_URL')) >> > >> > But I'm not sure where. Or how. >> > >> >> In theory , yes . Nevertheless DB string is supposed to be configured >> in trac.ini . I'm not sure if your approach will work , but I wonder >> why is it that config is not enough for you ? Maybe what you need is >> not exactly a plugin but an external script ? >> > > Hello, > > I have the exact same need as all my files configuration are versioned > and I would like to keep the database login/password outside the > configuration files (and the repository). > > It may also help if I share the repository with others: they can use > whatever database they see fit. > > Another solution would be to keep the database string in a dedicated > file (not in the repository) and import it in trac.ini. >
The recommended approach in this case is to use [inherit] file option in trac.ini and configure DB in an external file (empty by default?) . We use this in Bloodhound default installation to inherit in trac.ini the configs specified in base.ini . Inheritance levels are unlimited (afaict , but 2-3 levels should be enough ...) -- Regards, Olemis - @olemislc Apache⢠Bloodhound contributor http://issues.apache.org/bloodhound http://blood-hound.net Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/trac-dev. For more options, visit https://groups.google.com/groups/opt_out.
