# How to add configuration

**URL:** <https://www.ruby-forum.com/t/how-to-add-configuration/188057>\
**Category:** Engines\
**Created:** [May 5, 2010, 5:22am UTC](https://www.ruby-forum.com/t/how-to-add-configuration/188057 "2010-05-05T05:22:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anaconda\_wly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@anaconda\_wly](https://www.ruby-forum.com/u/anaconda_wly)\
**Post date:** [May 5, 2010, 5:22am UTC](https://www.ruby-forum.com/t/how-to-add-configuration/188057/1 "2010-05-05T05:22:09Z")

</div>

I want to add configuration used for my own app, seems like the second  
you mentioned. I create a file, adding a global variable in it for my  
use. Then I include the module when needed. Though it works fine, I  
don’t think it’s a good way when configure items increased. So I think  
the ROR must have a predefined file for programmers to config their own  
global variables.  
I found a folder under rails being named “config”, containing two  
subfolders(“environments”,“initializers”) and several .rb files. I’m  
not sure if I can do this in one of them. If configured, can I use the  
global variable directly? Or I shall use “require” or “include” in my  
code using it.  
thanks

---

<div class="post-metadata">

**Author:** ![anaconda\_wly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@anaconda\_wly](https://www.ruby-forum.com/u/anaconda_wly)\
**Post date:** [June 15, 2010, 8:16am UTC](https://www.ruby-forum.com/t/how-to-add-configuration/188057/2 "2010-06-15T08:16:56Z")

</div>

did get ur mean …

Wason Wang wrote:

> I want to add configuration used for my own app, seems like the second  
> you mentioned. I create a file, adding a global variable in it for my  
> use. Then I include the module when needed. Though it works fine, I  
> don’t think it’s a good way when configure items increased. So I think  
> the ROR must have a predefined file for programmers to config their own  
> global variables.  
> I found a folder under rails being named “config”, containing two  
> subfolders(“environments”,“initializers”) and several .rb files. I’m  
> not sure if I can do this in one of them. If configured, can I use the  
> global variable directly? Or I shall use “require” or “include” in my  
> code using it.  
> thanks
