Require data-sources directory in addition to models directory in app.boot(). - #284
Require data-sources directory in addition to models directory in app.boot().#284STRML wants to merge 1 commit into
app.boot().#284Conversation
This prevents a potential issue where a model is loaded from config that specifies a datasource that is loaded via JS. The model would typically be loaded before the datasource in this case, leading to an error. This allows the files in `data-sources` to be loaded with the full `appConfig` attached to the app object. Signed-off-by: Samuel Reed <sam@tixelated.com>
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
Hey @STRML, thank you for making the effort to submit the pull request. We are in process of moving I have a different plan for dynamic definition of datasources. Instead of requiring all files in
where $env is the value of I am very reluctant to allow developers to add datasources from other places than datasources.json, as it would it make difficult for tools like With the implementation proposed for loopback-boot, you would put all static configuration of your datasource to |
|
That works for me and is better than this monkey patch. My main concern is per-environment configuration of datasources, which is not elegant in the current version. Thank you for the lengthy reply, I will watch loopback-boot. |
This prevents a potential issue where a model is loaded from config JSON that specifies use a datasource
that is loaded via JS (e.g. via a module in
./data-sources). The model would typically be loaded before the datasource in this case, leading to an assertion error as the datasource is not properly set up.This allows the files in
data-sourcesto be loaded with the fullappConfigattached to the app object, allowing a datasource module to use environment configuration in its configuration.