You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Released deprecated gem migrating to the new name
17
20
18
-
# 0.5.0.beta1
21
+
## 0.5.0.beta1
22
+
23
+
* Ability to use in Settings file keywords reserved for OpenStruct: select, collect ([##95](https://github.com/railsjedi/config/issues/95))
24
+
* Made config work without Rails as a hard dependency ([##86](https://github.com/railsjedi/config/issues/86), [##88](https://github.com/railsjedi/config/issues/88))
25
+
* Fix generate error when .gitignore is missing ([##85](https://github.com/railsjedi/config/issues/85))
26
+
* Fix deprecation warning on File.exists? ([##81](https://github.com/railsjedi/config/issues/81))
27
+
* Add a shortcut method for setting files ([##67](https://github.com/railsjedi/config/issues/67))
* Ability to use in Settings file keywords reserved for OpenStruct: select, collect ([#95](https://github.com/railsjedi/config/issues/95))
21
-
* Made config work without Rails as a hard dependency ([#86](https://github.com/railsjedi/config/issues/86), [#88](https://github.com/railsjedi/config/issues/88))
22
-
* Fix generate error when .gitignore is missing ([#85](https://github.com/railsjedi/config/issues/85))
23
-
* Fix deprecation warning on File.exists? ([#81](https://github.com/railsjedi/config/issues/81))
24
-
* Add a shortcut method for setting files ([#67](https://github.com/railsjedi/config/issues/67))
* Ability to specify the app name when calling the Heroku rake task ([#75](https://github.com/railsjedi/config/issues/75))
32
+
* Ability to specify the app name when calling the Heroku rake task ([##75](https://github.com/railsjedi/config/issues/75))
29
33
30
-
# 0.4.1
34
+
##0.4.1
31
35
32
-
* Fixed compatibility with Rails 4.1 ([#72](https://github.com/railsjedi/config/issues/72))
36
+
* Fixed compatibility with Rails 4.1 ([##72](https://github.com/railsjedi/config/issues/72))
33
37
* Testing suite verifies compatibility with Rails 3.2, 4.0 and 4.1
34
38
35
-
# 0.4.0
39
+
##0.4.0
36
40
37
-
* Compatibility with Heroku ([#64](https://github.com/railsjedi/config/issues/64))
41
+
* Compatibility with Heroku ([##64](https://github.com/railsjedi/config/issues/64))
38
42
39
-
# 0.3.4
43
+
##0.3.4
40
44
41
-
* Expose Settings in application.rb, so you don't have to duplicate configuration for each environment file ([#59](https://github.com/railsjedi/config/issues/59))
42
-
* Adding support for Rails 4.1.0.rc ([#70](https://github.com/railsjedi/config/issues/70))
45
+
* Expose Settings in application.rb, so you don't have to duplicate configuration for each environment file ([##59](https://github.com/railsjedi/config/issues/59))
46
+
* Adding support for Rails 4.1.0.rc ([##70](https://github.com/railsjedi/config/issues/70))
Copy file name to clipboardexpand all lines: README.md
+39-25
Original file line number
Diff line number
Diff line change
@@ -12,23 +12,22 @@ Config helps you easily manage environment specific settings in an easy and usab
12
12
13
13
## Features
14
14
15
-
- simple YAML config files
16
-
- config files support ERB
17
-
- config files support inheritance and multiple environments
18
-
- access config information via convenient object member notation
19
-
- support for multi-level settings (`Settings.group.subgroup.setting`)
20
-
- local developer settings ignored when committing the code
15
+
* simple YAML config files
16
+
* config files support ERB
17
+
* config files support inheritance and multiple environments
18
+
* access config information via convenient object member notation
19
+
* support for multi-level settings (`Settings.group.subgroup.setting`)
20
+
* local developer settings ignored when committing the code
21
21
22
22
## Compatibility
23
23
24
-
- Ruby `2.x`
25
-
- Rails `>= 3.1` and `4`
26
-
- Padrino
27
-
- Sinatra
24
+
* Ruby `2.x`
25
+
* Rails `>= 3.1` and `4`
26
+
* Padrino
27
+
* Sinatra
28
28
29
29
For older versions of Rails or Ruby use [AppConfig](http://github.com/fredwu/app_config).
30
30
31
-
32
31
## Installing
33
32
34
33
### Installing on Rails 3 or 4
@@ -75,22 +74,25 @@ register Config
75
74
76
75
### Installing on Sinatra
77
76
78
-
Add the gem to your `Gemfile` and run `bundle install` to install it. Afterwards in need to register `Config` in your app and give it a root so it can find the config files.
77
+
Add the gem to your `Gemfile` and run `bundle install` to install it. Afterwards in need to register `Config` in your
78
+
app and give it a root so it can find the config files.
79
79
80
80
```ruby
81
81
set :root, File.dirname(__FILE__)
82
82
register Config
83
83
```
84
84
85
-
It's also possible to initialize `Config` manually within your configure block if you want to just give it some yml paths to load from.
85
+
It's also possible to initialize `Config` manually within your configure block if you want to just give it some yml
After installing the gem, `Settings` object will become available globally and by default will be compiled from the files listed below. Settings defined in files that are lower in the list override settings higher.
94
+
After installing the gem, `Settings` object will become available globally and by default will be compiled from the
95
+
files listed below. Settings defined in files that are lower in the list override settings higher.
94
96
95
97
config/settings.yml
96
98
config/settings/#{environment}.yml
@@ -142,7 +144,8 @@ Settings.reload_from_files(
142
144
143
145
### Environment specific config files
144
146
145
-
You can have environment specific config files. Environment specific config entries take precedence over common config entries.
147
+
You can have environment specific config files. Environment specific config entries take precedence over common config
This will do the same as `add_source`, but the given YML file will be loaded first (instead of last) and its settings will be overwritten by any other configuration file.
189
-
This is especially useful if you want to define defaults.
191
+
This will do the same as `add_source`, but the given YML file will be loaded first (instead of last) and its settings
192
+
will be overwritten by any other configuration file. This is especially useful if you want to define defaults.
190
193
191
-
One thing I like to do for my Rails projects is provide a local.yml config file that is .gitignored (so its independent per developer). Then I create a new initializer in `config/initializers/add_local_config.rb` with the contents
194
+
One thing I like to do for my Rails projects is provide a local.yml config file that is .gitignored (so its independent
195
+
per developer). Then I create a new initializer in `config/initializers/add_local_config.rb` with the contents
> Note: this is an example usage, it is easier to just use the default local files `settings.local.yml, settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
202
+
> Note: this is an example usage, it is easier to just use the default local files `settings.local.yml,
203
+
settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
199
204
200
205
## Embedded Ruby (ERB)
201
206
202
207
Embedded Ruby is allowed in the configuration files. Consider the two following config files.
* `knockout_prefix` - ability to remove elements of the array set in earlier loaded settings file. Default: `nil`
265
272
266
-
267
273
## Working with Heroku
268
274
269
-
Heroku uses ENV object to store sensitive settings which are like the local files described above. You cannot upload such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh.
275
+
Heroku uses ENV object to store sensitive settings which are like the local files described above. You cannot upload
276
+
such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh.
270
277
271
278
To use config with Heroku just set the `use_env` var to `true` in your `config/initializers/config.rb` file. Eg:
272
279
@@ -277,7 +284,8 @@ Config.setup do |config|
277
284
end
278
285
```
279
286
280
-
Now config would read values from the ENV object to the settings. For the example above it would look for keys starting with 'AppSettings'. Eg:
287
+
Now config would read values from the ENV object to the settings. For the example above it would look for keys starting
288
+
with 'AppSettings'. Eg:
281
289
282
290
```ruby
283
291
ENV['AppSettings.section.size'] = 1
@@ -293,13 +301,19 @@ To upload your local values to Heroku you could ran `bundle exec rake config:her
293
301
Bootstrap
294
302
295
303
```bash
296
-
$ appraisal install
304
+
appraisal install
305
+
```
306
+
307
+
Run the test suite:
308
+
309
+
```bash
310
+
appraisal rspec
297
311
```
298
312
299
-
Running the test suite
313
+
If you modified any of the documentation files verify their format:
0 commit comments