views:

93

answers:

1

Hi, I am doing some trial testing awith Amazon ec2 boxes, deploying flex apps running on top of restlet powered webservices. I have this problem - Everytime i deploy the app to the cloud, I'm having to hardcode the IP address of the server into the ActionScript/MXML files (http://72.93.48.39:8080/xxx/abc/) and for certain reasons, i am forced to choose a different IP everytime. and i think its really not the right way to deploy the application.

I would like to know what other people do in such scenarios?

On thinking about it, i thought i could make it pickup values from the HTMLVars of the HTML wrapper. but that again has to be edited everytime again and again.

will it be possible to be able to supply these values : server's ip address, server's port number(in case its not 8080 on some machine) at build time? if so can anyone give me a barbones sample build.xml just as an example?

A: 

After much research I (think) have finally found a way to do this. the solution is ant's build.xml file based

the solution is to use EnvGen ant Task to generate a "config.xml" file of sorts. The EnvGen task works on the FreeMarker model - so it takes data and a template to generate files. Data is to be supplied via a CSV file. Template is to be specified using the Freemarker Template .ftl file. Depending on the template EnvGen generates XML files too. the link to EnvGen Task is here - http://www.basilv.com/psd/software-files/EnvGen/index.html#InstallEnvGen

And finally, we program the Flex app to pick up the server end point values from the config.xml file.

Hope this helps someone who is looking for this answer

Vatsala
http://vatsalad.wordpress.com/2010/08/15/how-to-deploy-your-flex-app-to-different-servers-without-hardcoding-the-url/
Vatsala