Can you add packages form code?

As the question asks, I was thinking of having a settings.json file that only added Google Analytics and other things depending on settings. Would also be nice to be able to add-on features in site which may be packages. I would assume this would cause a server restart and such but is it possible?

Do you mean at application run time, rather than application build time?

Yes while the application is running is there a way through the server side code to add a package and restart the server?

I’m thinking not, because all client and server code has been built and deployed by then, but I’m happy to be proven wrong. :smile:

I haven’t found a way, which is why I’m asking here. It would be nice if there was a way to hook Meteor in to adding the package and restarting the server - similar to adding the package locally and redeploying.

If the app’s already built it’s not as simple as that. In most cases the build and production environments are not the same (I hope not, anyway :wink:). That means you would have to automate going back to build with a changed package requirement, rebuilding and then redeploying.

The only thing I can think of which might come close to automating that in a “build, create and throwaway” model would be to use something like Docker Compose triggered by some sort of hook.

Yea I understand… but adding in a package is not like adding in new custom code… so I was thinking this could be possible and if not done yet maybe looked into as a feature request. This is one road block which prevented making a truly comprehensive CMS in Meteor because you have to be able to add plugins, themes, etc. and those can only be done through packages. You would ideally want to do this from an admin section and add to a running app.