Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When working with AppHarbor, how can I properly manage development and live configuration files?

I have a small project under way, in which I'm experimenting with AppHarbor. For those of you who aren't familiar with it, AppHarbor allows you to automatically build and deploy ASP.NET MVC projects in the cloud, by adding a specific Git remote and then pushing your project/source to that remote.

The way I'm currently working is that I'll have a master Git repository on GitHub, which I clone to my development machine. I then add the AppHarbor remote to my working copy. I'll make my changes, push to GitHub every few commits for safe-keeping, and when I'm ready to deploy a new version I can just push it up to AppHarbor.

While this is a great workflow, it brings up a new problem for me concerning configuration files. What I used to do is to exclude Web.config from source control and instead check in a file called Web.config.example, which contained all the correct keys but with dummy values. I would then simply make a copy of that file on my dev machine, remove the .example extension and edit the values to suit.

When it came to deployment, I'd create another copy called Web.config.live, replace the values with the correct ones for the server, upload it and remove the .live extension.

The problem I have now is that if Web.config is not under source control, when I push to AppHarbor, the project won't work (because it's lacking the proper configuration information). Yet I don't want the live connection string publically viewable on GitHub, which it would be if I ever pushed Web.config to the master repo.

What are my options here? I'd be grateful for any advice.

like image 688
Mark Bell Avatar asked Jun 29 '11 11:06

Mark Bell


1 Answers

AppHarbor supports replacement of configuration variables on deploy to avoid the problem of committing usernames and passwords to source control (amongst other uses). It's documented in the knowledge-base.

like image 58
friism Avatar answered Oct 26 '22 13:10

friism