Skip to content

[loopback-boot] Configure location of config.json file #584

Closed

Description

@johnsoftek

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.

Activity

  1. changed the title [-]Cannot configure location of config.json file[/-] [+][loopback-boot] Configure location of config.json file[/+] on Sep 29, 2014
  2. bajtos commented on Sep 29, 2014

    @bajtos
    Member

    @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?

  3. johnsoftek commented on Sep 29, 2014

    @johnsoftek
    Author

    Will do

    On 29 September 2014 21:17, Miroslav Bajtoš notifications@github.com
    wrote:

    @johnsoftek https://github.com/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 https://github.com/strongloop/loopback-boot?

    —
    Reply to this email directly or view it on GitHub
    #584 (comment).

  4. rhalff commented on Sep 29, 2014

    @rhalff
    Contributor

    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.:

    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.

  5. bajtos commented on Sep 29, 2014

    @bajtos
    Member

    @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.

  6. bitmage commented on Jan 21, 2015

    @bitmage
    Contributor

    @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:

    1. appRootDir
    2. config
    3. modelSources
    4. bootDirs
    5. models

    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!

  7. rhalff commented on Jan 21, 2015

    @rhalff
    Contributor

    @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.

  8. bajtos commented on Jan 21, 2015

    @bajtos
    Member

    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.

    @bitmage Can you use my gist to create some documentation around this? Hopefully that will save others the trouble of hunting through the code.

    Sorry, I don't have bandwidth for that myself. Would you mind contributing the docs yourself? See the instructions.

  9. bitmage commented on Jan 22, 2015

    @bitmage
    Contributor

    Oh, cool. I wasn't aware of any avenue for community contributions. I'll check that out. Thanks!

  10. bitmage commented on Jan 22, 2015

    @bitmage
    Contributor

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions