[dancer-users] Dancer2 -- multiple apps with different config(.yml) in one process

Erik Huelsmann ehuels at gmail.com
Sun May 27 18:33:06 BST 2018


Over at the LedgerSMB project (https://ledgersmb.org/), we moved a lot of
our old CGI code to PSGI over the last year. Recently, I've factored out
many "infrastructure" level items into Plack middleware.

We've wanted to move to Dancer as our web framework for years. And this
weekend I made a first stab at such a move. As a result I have some
questions (but more may come). Some questions were immediately answered by
Stephan Hornburg in our chat channel (thanks Stephan!) but the most
important one remains open.

Question: Dancer2's documentation points out that we can use 2 applications
hosted on 1 PSGI server. The relevant section is:
And while that works, both of these applications resolve their
configuration to one and the same "config.yml". This is where my problem
is: while I don't mind (would like to, even) share 99% of the configuration
between two applications I want to mount, the two applications I want to
mount, need separate authentication cookies. As far as I'm aware, I'd need
to resolve to two different "config.yml" files (in my case I'd prefer
"main_config.yml" and "setup_config.yml").

A bit of background to my question: LedgerSMB is an ERP application which
consists of two logically separate applications: 'main' and 'setup'. "main"
is the application for regular users while "setup" is for
application/functional maintenance (application admin). Since many
businesses have a "superuser" appointed as their admin, this user has 2
roles. He may want to log into both applications at the same time, each in
a separate window on the same browser. In order to be able to do that, I
need to be able to set the session cookie for both applications to be
different from each other. It's my understanding that the "best" way to set
cookie names through the configuration. Hence my question how to get two
applications pointing to two different configuration files.

I've tried multiple approaches so far without success:
1. "use Dancer2 config_location => 'path/to/config';"
2. read the sources of Dancer2 for a couple of hours
3. Ask racke

Could you please advise? Thanks in advance!



http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20180527/b6283878/attachment.html>

More information about the dancer-users mailing list