[Catalyst] Using URIs for my app in another program
Byron.Young at riverbed.com
Sat Jun 7 03:06:03 BST 2008
Tomas Doran wrote on 2008-06-06:
> On 7 Jun 2008, at 01:17, Byron Young wrote:
>> Is there any way to fake a request when my app starts? It seems
>> like a bit of a catch-22 -- I need to know a URL in order to fake
>> the request, but in order to generate the URL I need to have a
> The problem which you have here is that the application doesn't know
> what URLs it's attached to until run time.
> Remember - you can have multiple virtual hosts pointing to the same
> application instance, therefore catalyst *can't* know in advance
> where it is going to be served from.
True. All I need to know in this case is just one valid URL, though.
> The simple perl HTTP engine which script/myapp_server.pl uses prints a
> nice message with the app URL - but that's because it's a toy compared
> to what you might do in real deployment.
>> Am I doomed to storing the URL for my 'populate database with urls'
>> action in a config file and updating it by hand when I move the web app?
> I think so, but I think that you *want* to do this. Otherwise, how do
> you deal with testing the app? And also testing your thing which
> requests the app. Surely you're gonna want to be able to test against
> demo servers you've brought up on localhost?
Actually, that's specifically the use case I'm thinking of here. Each developer on this project has his own testing setup on the dev machine, while the production version runs on another host. Each test setup includes a database, daemon, and web app. We do use config files to point everything to the right codebase and database, so it's not the end of the world to add another entry for the url, but I try to be careful of the amount of configuration we need. I want to avoid the situation where a developer forgets to change his dev config file to point to his dev web app and so his daemon ends up talking to the production server instead, potentially resulting in something bad happening. So, if there is some totally automated way to do things instead, I opt for that.
Of course, this may just be exposing some bad practices on our end wrt to dev environments and config files and protecting the production server from fallible developers such as myself.
> I think that you're trying to solve the wrong problem here, sorry. To be
> honest - how often are you really going to move the webapp once it's
> deployed? What's wrong with giving it it's own DNS CNAME which you
> switch between boxen hosting it?
Yeah, that's true - we probably won't move the production app, and we'll use a CNAME if we do.
Thanks for your help
More information about the Catalyst