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
{{ message }}
Repository navigation
[loopback-boot] Configure location of config.json file #584
For cleaner version control, I wish to move all of the installation specific files outside the app directory. The two files that change for each installation are config.json and datasources.json
Loopback boot allows the location of various config files to be passed to boot() e.g. modelsRootDir, dsRootDir. However, there is no provision for specifying the location of the config.json file.
@johnsoftek Thank you for reporting the issue. We don't have bandwidth to implement your request in a foreseeable future. Can you implement the change yourself and submit a pull request to loopback-boot?
Everything within the config: section you can get back later using app.get(), e.g.:
var storage = app.get('storage');
Naming it storage: in this case is just something I found convenient, it's not required.
If you do not define a property within the options object the default behaviour for that property will occur.
The default behaviour for config is to first read config.json and then config.env.json.
When you use it like above that behaviour will be gone, unless you implement it yourself again.
@rhalff thanks for sharing an alternative approach.
It was my intention to keep the boostrapper highly configurable, so that people can either provide a custom JSON structure with all data, or even do not call loopback-boot at all and use loopback methods like loopback.createModel directly. I am glad the effort is paying off.
@rhalff this didn't quite work for me, I had to add the following fields to the config in order to restore boot script loading and other default behavior:
@bajtos agreed on the flexibility, this is great. Can you use my gist to create some documentation around this? Hopefully that will save others the trouble of hunting through the code. Thanks!
@rhalff I use vim. I'm not concerned about arc functionality in this case... more concerned with the deployment story, which was totally not functional for me using the default approach.
Activity
[-]Cannot configure location of config.json file[/-][+][loopback-boot] Configure location of config.json file[/+]bajtos commentedon Sep 29, 2014
@johnsoftek Thank you for reporting the issue. We don't have bandwidth to implement your request in a foreseeable future. Can you implement the change yourself and submit a pull request to loopback-boot?
johnsoftek commentedon Sep 29, 2014
Will do
On 29 September 2014 21:17, Miroslav Bajtoš notifications@github.com
wrote:
rhalff commentedon Sep 29, 2014
I would like to comment on this for I also found it easier to just define things within one config file.
I've implemented such an override here:
https://github.com/rhalff/swinger/blob/master/server/server.js#L23
It uses a custom config module, but you can just as easy provide your own json.
An example of what the object structure can look like:
https://github.com/rhalff/swinger/blob/master/server/config.production.js
Everything within the
config:section you can get back later using app.get(), e.g.:Naming it
storage:in this case is just something I found convenient, it's not required.If you do not define a property within the options object the default behaviour for that property will occur.
The default behaviour for
configis to first readconfig.jsonand thenconfig.env.json.When you use it like above that behaviour will be gone, unless you implement it yourself again.
bajtos commentedon Sep 29, 2014
@rhalff thanks for sharing an alternative approach.
It was my intention to keep the boostrapper highly configurable, so that people can either provide a custom JSON structure with all data, or even do not call loopback-boot at all and use loopback methods like
loopback.createModeldirectly. I am glad the effort is paying off.bitmage commentedon Jan 21, 2015
@rhalff this didn't quite work for me, I had to add the following fields to the config in order to restore boot script loading and other default behavior:
Here is the resulting config.js for me.
@bajtos agreed on the flexibility, this is great. Can you use my gist to create some documentation around this? Hopefully that will save others the trouble of hunting through the code. Thanks!
rhalff commentedon Jan 21, 2015
@bitmage I think the tooling build around loopback relies on the config dir structure: e.g. http://strongloop.com/node-js/arc/
Drifting away from that convention does make things incompatible.
Also note I never finished the project mentioned above, it was a fork from:
https://github.com/beeman/loopback-angular-admin which still is actively being developed.
Anyway, I think one config file probably does fit some use cases.
bajtos commentedon Jan 21, 2015
The feature requested in the issue description has been implemented by #43 and released in
loopback-boot@2.1.0, I am closing the issue.Sorry, I don't have bandwidth for that myself. Would you mind contributing the docs yourself? See the instructions.
bitmage commentedon Jan 22, 2015
Oh, cool. I wasn't aware of any avenue for community contributions. I'll check that out. Thanks!
bitmage commentedon Jan 22, 2015
@rhalff I use vim. I'm not concerned about arc functionality in this case... more concerned with the deployment story, which was totally not functional for me using the default approach.