Packed app with editable settings

Hi again,

In previous versions, I use to have an AppConfig.js file where I put my application settings such as endpoints and stuff like that.
File content Sample:
var AppConfig = {
    Endpoints:{
        Users: "(...)/users",
        News: "(...)/news"
    },
    SettingA: "XPTO"
}
That way, I was able to simply call AppConfig. at any place of my app.

The problem now is that in the new version (as far as I know) I am only able to include scripts in .enyoconfig headScripts/tailScripts and those scripts get packed/minified.

So, I am not able to easily change my app configurations after the app package and installation.

Any ideas or suggestions to have a configuration file?

Comments

  • Few options to weigh:
    • Separate builds for each config -- Could be cumbersome if you need to support many configurations but avoids an extra round trip for what is static information for a particular deployment
    • Use inlineJs: false or --no-inline-js to disable inlining -- prevents bundling headScripts but loses advantages of inlining everything else
    • Custom index.html template -- little more work to make it (you can copy enyo-dev's version) but allows you to add a script tag for your config file.
    • Load the config file via Ajax on load -- flexible but probably more flexible than you need. likely slower time-to-render because you'd still incur the load/parse time for your entire app before then fetching the config. You could work around that but the increasing complexity makes this option less desirable.
  • Thanks a lot.

    I had already thought about these scenarios. The only one I missed was the separate builds. I was wondering if I was missing others possibilities.
    I will go with de index template. I think it’s the best one. That way I will have performance and the ability to edit settings as I desire.
    The work it’s really little as you said.

    Once again, Thanks a lot.
Sign In or Register to comment.