# Detect Application Server

**URL:** <https://www.ruby-forum.com/t/detect-application-server/75833>\
**Category:** Rails\
**Created:** [November 13, 2006, 8:02pm UTC](https://www.ruby-forum.com/t/detect-application-server/75833 "2006-11-13T20:02:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 13, 2006, 8:02pm UTC](https://www.ruby-forum.com/t/detect-application-server/75833/1 "2006-11-13T20:02:01Z")

</div>

I am working on a ruby app where the user fills out a form that gets  
sent via email. Sometimes I work on the app at my computer at home and  
other times at work. I need to setup the development environment so  
that the app detects which server it is currently running on and uses  
the appropriate smtp host. I am relatively new to Ruby on Rails, so am  
not sure of the best way to do this. Thanks for any help.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 13, 2006, 8:18pm UTC](https://www.ruby-forum.com/t/detect-application-server/75833/2 "2006-11-13T20:18:07Z")

</div>

On 11/13/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

I would probably keep it simple and just check the hostname of the  
machine by making a system call in development.rb

`hostname` # =\> ‘dev\_box1’

Hope this helps.

–  
Zack C.  
[http://depixelate.com](http://depixelate.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 13, 2006, 8:21pm UTC](https://www.ruby-forum.com/t/detect-application-server/75833/3 "2006-11-13T20:21:12Z")

</div>

Or you could have 2 environements, development\_home, and development  
office, with the majority of settings being common, but with different  
smtp stuff.

Fred

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 13, 2006, 8:28pm UTC](https://www.ruby-forum.com/t/detect-application-server/75833/4 "2006-11-13T20:28:15Z")

</div>

Thanks, and I am familiar withe development.rb file, but am not sure  
how I would implement your suggestion. Thanks again.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 13, 2006, 8:28pm UTC](https://www.ruby-forum.com/t/detect-application-server/75833/5 "2006-11-13T20:28:16Z")

</div>

Thanks. That makes sense!!! Duh, how did I miss that idea. Thanks  
again!!
