ultra_settings 2.4.4 → 2.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +10 -0
- data/VERSION +1 -1
- data/lib/ultra_settings/configuration.rb +5 -0
- data/lib/ultra_settings/railtie.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0100a325a4565201a02667584d60b608a1fa0953c35a18c77ab014c205578853
|
4
|
+
data.tar.gz: 7728dd534db12acac88f7f9c23ee4cee76dddba40d7b89ba23f2873bcc873fe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae0580fb25bdad6baddec3ca0ba78bb506df187889ba976487280a850e931fbcb55d52684dfe06e46d38364432954ae87cb20e6c6fa7bcd530d7476bb9d7651e
|
7
|
+
data.tar.gz: 591b48efe616f8e288ecc1b5bdc1c116a2d4babcb0c32463eb5fe53ce1a7dffc739a762e46bdf54863e4f24dd5a245b47e515c64342e5c17916c76aab8638c93
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 2.4.5
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Add check for nil YAML config path to avoid error loading YAML file if the path is not set.
|
12
|
+
|
7
13
|
## 2.4.4
|
8
14
|
|
9
15
|
### Changed
|
data/README.md
CHANGED
@@ -261,6 +261,16 @@ While for production, the values would be the combination of `production` and `s
|
|
261
261
|
|
262
262
|
In a Rails application, the YAML environment will be set to the Rails environment and YAML files will be assumed to exist in the `config` directory.
|
263
263
|
|
264
|
+
If want to use configuration objects in code that is initialized with the Rails application before initializers are run, then you'll need to setup the configuration manually.
|
265
|
+
|
266
|
+
For instance, if you want to create a `DatabaseConfiguration` class that is used in the ERB code in `database.yml`, then you'll need to setup the configuration before the Rails application is initialized in `application.rb`.
|
267
|
+
|
268
|
+
```ruby
|
269
|
+
UltraSettings.yaml_config_env = Rails.env
|
270
|
+
UltraSettings.yaml_config_path = __dir__
|
271
|
+
require_relative '../app/configurations/database_configuration'
|
272
|
+
```
|
273
|
+
|
264
274
|
### Removing The Hierarchy
|
265
275
|
|
266
276
|
If you prefer not to use the default hierarchy of environment variables, runtime settings, and YAML files, you can disable it. This allows you to explicitly define which data sources should be used for each field.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.4.
|
1
|
+
2.4.5
|
@@ -158,6 +158,9 @@ module UltraSettings
|
|
158
158
|
# @return [Pathname, nil]
|
159
159
|
def configuration_file
|
160
160
|
unless defined?(@configuration_file)
|
161
|
+
default_file = default_configuration_file
|
162
|
+
return nil if default_file.nil?
|
163
|
+
|
161
164
|
@configuration_file = default_configuration_file
|
162
165
|
end
|
163
166
|
return nil? unless @configuration_file
|
@@ -383,6 +386,8 @@ module UltraSettings
|
|
383
386
|
end
|
384
387
|
|
385
388
|
def default_configuration_file
|
389
|
+
return nil if yaml_config_path.nil?
|
390
|
+
|
386
391
|
path = Pathname.new(yaml_config_path)
|
387
392
|
path.join(*"#{root_name}.yml".split("/"))
|
388
393
|
end
|
@@ -9,6 +9,7 @@ module UltraSettings
|
|
9
9
|
config.ultra_settings = ActiveSupport::OrderedOptions.new
|
10
10
|
config.ultra_settings.auto_load_directories ||= [File.join("app", "configurations")]
|
11
11
|
|
12
|
+
# initializer "ultra_settings.before_bootstrap", before: :bootstrap_hook do
|
12
13
|
config.before_configuration do
|
13
14
|
UltraSettings::Configuration.yaml_config_env ||= Rails.env
|
14
15
|
UltraSettings::Configuration.yaml_config_path ||= Rails.root.join("config")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultra_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Durand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|