[dancer-users] Multiple config files for Dancer2 app

Amelia Ireland aireland at lbl.gov
Mon Aug 17 23:20:39 BST 2015


> Date: Thu, 23 Jul 2015 19:31:45 +0200
>
> From: Sawyer X <xsawyerx at gmail.com>
> I suggest not using Dancer2 for the config loading here. The config
loading
> for Dancer2 really should be for the framework. Even though you can add
> configurations for the app, it seems like a very custom and advanced
> situation.
>
> What I recommend is having a setup() method in your app that loads
> configuration files for the database handles. Then you call that setup and
> *then* call ->to_app.
>
> Do you understand what I mean?

I believe so -- I had a look at your (SawyerX's) Act code (on github) and
you've used setup in a similar way there.

Is it possible to use a setup() method to alter the contents of the
'config' variable? For example, I would like to be able to switch sessions
on and off without having to remove the session engine settings from the
config file. If it's not possible, it's not a problem -- I'll do things a
different way.

Thanks!
Amelia.


> On Thu, Jul 23, 2015 at 12:48 AM, Amelia Ireland <aireland at lbl.gov> wrote:
>
> > To answer my own question, the easiest thing is to use
> > app->load_config_file(...) and merge the settings into the app config.
> >
> >
> > On 22 July 2015 at 15:41, Amelia Ireland <aireland at lbl.gov> wrote:
> > >
> > >> Hello all,
> > >>
> > >> Is there a recommended method for using multiple configuration files
> > for a
> > >> Dancer2 application in addition to the config.xxx and
> > >> development.xxx/production.xxx files? My app uses a couple of
databases
> > >> with passwords that are changed on a regular basis, and I'd like to
be
> > able
> > >> to drop DB config files into the environments folder and have them
> > >> automatically included rather than having to edit config files by
hand
> > or
> > >> regenerate them by script. If there's something that already exists
> > that I
> > >> can use, that would be great!
> > >>
> > >> Thanks!
> > >> Amelia.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150817/1f1d2f35/attachment.html>


More information about the dancer-users mailing list