# App.config file in a rails app

**URL:** <https://www.ruby-forum.com/t/app-config-file-in-a-rails-app/187666>\
**Category:** IronRuby\
**Created:** [April 27, 2010, 3:46pm UTC](https://www.ruby-forum.com/t/app-config-file-in-a-rails-app/187666 "2010-04-27T15:46:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Ortman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@Chris\_Ortman](https://www.ruby-forum.com/u/Chris_Ortman)\
**Post date:** [April 27, 2010, 3:46pm UTC](https://www.ruby-forum.com/t/app-config-file-in-a-rails-app/187666/1 "2010-04-27T15:46:07Z")

</div>

I am playing around with ir + rails and using it in front of a bunch of  
existing .NET code.  
The .NET code really really wants a couple of settings in   
When i run via script/server though the app.config file is ir.exe.config  
(AppDomain.Current.SetupInformation.ConfigurationFile)… is there a way  
to  
override what config file is loaded?

Thanks

---

<div class="post-metadata">

**Author:** ![Chris\_Ortman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@Chris\_Ortman](https://www.ruby-forum.com/u/Chris_Ortman)\
**Post date:** [April 27, 2010, 7:55pm UTC](https://www.ruby-forum.com/t/app-config-file-in-a-rails-app/187666/2 "2010-04-27T19:55:00Z")

</div>

A couple of options here.

1. 

```
 Use/create a .NET executable with app.config file. One option is 

```

to copy ir.exe to the root directory of your app and add ir.exe.config  
with appSettings that you need. Don’t forget to change Ruby library  
paths in that ir.exe.config file. You’ll also need to copy the rest of  
the assemblies from IronRuby bin directory to the same directory as  
ir.exe (or some subdirectory that you specify in element of  
ir.exe.config, see  
[\<probing\> Element | Microsoft Learn](http://msdn.microsoft.com/en-us/library/823z9h8w(VS.80).aspx)) or to the  
GAC (using gacutil.exe:  
[Global Assembly Cache Tool (Gacutil.exe) | Microsoft Learn](http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx)).

1. 

```
 Create an AppDomain that is set up to use the right config file: 

```

[AppDomainSetup.ConfigurationFile Property (System) | Microsoft Learn](http://msdn.microsoft.com/en-us/library/system.appdomainsetup.configurationfile(v=VS.100).aspx).  
Then launch the entire rails application (script/server) in that  
AppDomain.

Tomas

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Chris Ortman  
Sent: Tuesday, April 27, 2010 6:45 AM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] app.config file in a rails app

I am playing around with ir + rails and using it in front of a bunch of  
existing .NET code.  
The .NET code really really wants a couple of settings in   
When i run via script/server though the app.config file is ir.exe.config  
(AppDomain.Current.SetupInformation.ConfigurationFile)… is there a way  
to override what config file is loaded?

Thanks

---

<div class="post-metadata">

**Author:** ![Chris\_Ortman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@Chris\_Ortman](https://www.ruby-forum.com/u/Chris_Ortman)\
**Post date:** [April 27, 2010, 8:36pm UTC](https://www.ruby-forum.com/t/app-config-file-in-a-rails-app/187666/3 "2010-04-27T20:36:35Z")

</div>

Here’s a better link:  
[http://ironruby.net/Documentation/Real\_Ruby\_Applications/Rails#webserver-production](http://ironruby.net/Documentation/Real_Ruby_Applications/Rails#webserver-production)  
… it’ll be where other info about deploying Rails will be, and now has  
a screencast showing how to build IronRuby.Rack.

~js

From: Jimmy S.  
Sent: Tuesday, April 27, 2010 11:34 AM  
To: removed\_email\_address@domain.invalid  
Subject: RE: [Ironruby-core] app.config file in a rails app

You could do that, but is your eventual goal to actually deploy the app?  
If so I’d suggest using IronRuby.Rack  
([http://github.com/ironruby/ironruby/tree/master/Merlin/Main/Hosts/IronRuby.Rack](http://github.com/ironruby/ironruby/tree/master/Merlin/Main/Hosts/IronRuby.Rack))  
which lets you run Rails on [ASP.NET](http://ASP.NET) webservers (IIS, for example). It  
requires that you have a web.config in your application, so you could  
put settings in there.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tomas M.  
Sent: Tuesday, April 27, 2010 10:53 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] app.config file in a rails app

A couple of options here.

1. 

```
 Use/create a .NET executable with app.config file. One option is 

```

to copy ir.exe to the root directory of your app and add ir.exe.config  
with appSettings that you need. Don’t forget to change Ruby library  
paths in that ir.exe.config file. You’ll also need to copy the rest of  
the assemblies from IronRuby bin directory to the same directory as  
ir.exe (or some subdirectory that you specify in element of  
ir.exe.config, see  
[\<probing\> Element | Microsoft Learn](http://msdn.microsoft.com/en-us/library/823z9h8w(VS.80).aspx)) or to the  
GAC (using gacutil.exe:  
[Global Assembly Cache Tool (Gacutil.exe) | Microsoft Learn](http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx)).

1. 

```
 Create an AppDomain that is set up to use the right config file: 

```

[AppDomainSetup.ConfigurationFile Property (System) | Microsoft Learn](http://msdn.microsoft.com/en-us/library/system.appdomainsetup.configurationfile(v=VS.100).aspx).  
Then launch the entire rails application (script/server) in that  
AppDomain.

Tomas

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Chris Ortman  
Sent: Tuesday, April 27, 2010 6:45 AM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] app.config file in a rails app

I am playing around with ir + rails and using it in front of a bunch of  
existing .NET code.  
The .NET code really really wants a couple of settings in   
When i run via script/server though the app.config file is ir.exe.config  
(AppDomain.Current.SetupInformation.ConfigurationFile)… is there a way  
to override what config file is loaded?

Thanks

---

<div class="post-metadata">

**Author:** ![Chris\_Ortman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@Chris\_Ortman](https://www.ruby-forum.com/u/Chris_Ortman)\
**Post date:** [April 29, 2010, 6:31pm UTC](https://www.ruby-forum.com/t/app-config-file-in-a-rails-app/187666/4 "2010-04-29T18:31:04Z")

</div>

I went with the rack based approach. Took me a few tries to get right,  
but  
works slick once it is set up.

Thanks a bunch

On Tue, Apr 27, 2010 at 1:33 PM, Jimmy S. \<

---

<div class="post-metadata">

**Author:** ![Chris\_Ortman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@Chris\_Ortman](https://www.ruby-forum.com/u/Chris_Ortman)\
**Post date:** [April 27, 2010, 8:55pm UTC](https://www.ruby-forum.com/t/app-config-file-in-a-rails-app/187666/5 "2010-04-27T20:55:54Z")

</div>

You could do that, but is your eventual goal to actually deploy the app?  
If so I’d suggest using IronRuby.Rack  
([http://github.com/ironruby/ironruby/tree/master/Merlin/Main/Hosts/IronRuby.Rack](http://github.com/ironruby/ironruby/tree/master/Merlin/Main/Hosts/IronRuby.Rack))  
which lets you run Rails on [ASP.NET](http://ASP.NET) webservers (IIS, for example). It  
requires that you have a web.config in your application, so you could  
put settings in there.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tomas M.  
Sent: Tuesday, April 27, 2010 10:53 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] app.config file in a rails app

A couple of options here.

1. 

```
 Use/create a .NET executable with app.config file. One option is 

```

to copy ir.exe to the root directory of your app and add ir.exe.config  
with appSettings that you need. Don’t forget to change Ruby library  
paths in that ir.exe.config file. You’ll also need to copy the rest of  
the assemblies from IronRuby bin directory to the same directory as  
ir.exe (or some subdirectory that you specify in element of  
ir.exe.config, see  
[\<probing\> Element | Microsoft Learn](http://msdn.microsoft.com/en-us/library/823z9h8w(VS.80).aspx)) or to the  
GAC (using gacutil.exe:  
[Global Assembly Cache Tool (Gacutil.exe) | Microsoft Learn](http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx)).

1. 

```
 Create an AppDomain that is set up to use the right config file: 

```

[AppDomainSetup.ConfigurationFile Property (System) | Microsoft Learn](http://msdn.microsoft.com/en-us/library/system.appdomainsetup.configurationfile(v=VS.100).aspx).  
Then launch the entire rails application (script/server) in that  
AppDomain.

Tomas

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Chris Ortman  
Sent: Tuesday, April 27, 2010 6:45 AM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] app.config file in a rails app

I am playing around with ir + rails and using it in front of a bunch of  
existing .NET code.  
The .NET code really really wants a couple of settings in   
When i run via script/server though the app.config file is ir.exe.config  
(AppDomain.Current.SetupInformation.ConfigurationFile)… is there a way  
to override what config file is loaded?

Thanks
