Comments (3)
@cjlarose wdyt?
from config.
We also use engines in ManageIQ, but our use case is a little different. Basically we use Rails engines as a plugin system, and one of the pluggable things is the config settings. These engines can bring their own settings.yml and we will add those to the set of YAML Sources.
To do this we built an initializer that essentially loads config from all of our engines and the main app, all in the expected override order, then replaces the Settings constant. You can see the code here and follow along: https://github.com/ManageIQ/manageiq/blob/0a1c16529c96eb5367ed311e08fcd881f94cc818/lib/vmdb/settings.rb#L30, but tl;dr we loop through all of the engines in our application and add YAML Sources for each of them.
Ideally, config should more or less just work with engines and ManageIQ shouldn't have to have a custom initializer. I'm not sure if they should automatically work with engines by detecting settings.yml files, or if it makes sense to have a Config parameter where you opt in to which engines you want to honor settings from.
The other question is which way does priority work? If a key appears in the main application's settings and an engine's settings, which one wins? In ManageIQ our priority is that engines override the main application, but I'm not sure that same decision applies outside of our specific application or not.
from config.
Ideally, config should more or less just work with engines and ManageIQ shouldn't have to have a custom initializer
Agree with this part. At the moment I can customize the code on my engine to make it work. Not a big issue. But would be nice if it could just work with Rails engine, since from the engine's perspective, it's just another gem.
At the moment I'm not sure either on the solution, or the gem's direction with Rails engine. Just opened an issue here in case others might face the same issues that I have.
from config.
Related Issues (20)
- Quoted numeric values should be returned as strings, not parsed into numbers HOT 6
- Ways to reload config of a running process? HOT 1
- Is it possible to reference another configuration in a YAML file? HOT 2
- Unexpected formatting of ENV variable values HOT 6
- Pioneer's question HOT 1
- Preserve newlines while using embedded Ruby HOT 2
- Error using Ruby 3.1.0 : Psych::DisallowedClass: Tried to load unspecified class: Time HOT 2
- avoid Hash monkey patch when loading DeepMerge HOT 2
- Hash sources get clobbered in `Settings.reload!` HOT 1
- ENV variables not loaded with config HOT 12
- Feature Request: Rake Task to generate env-file HOT 1
- Help with beef please HOT 1
- Released Version 4.1.0 still uses removed method `File.exists?` HOT 7
- minimum, maximum keys are conflicted with active_support methods. HOT 8
- Extend Rails integration to application HOT 3
- Environment variables not loaded anymore after upgrading to Rails 6.1.7.3 HOT 2
- How to use/mock in rspec? HOT 3
- Allow to use custom filename && directory name to store configs HOT 2
- Converting to hash is creating an error (Ruby 3.2.2, config 5.0, Rails 6.1) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from config.