Is possible to dynamic load a package from on a running project?

I’m trying to do some crazy dynamic things and all this Elixir thing is very new to me, so i have a little question :slight_smile:

If i have a running api in elixir, let’s imagine a client call something like ‘GET /load-plugin/magic’.
Could i install the package magic from into the running app and starting using it or this is just too magic for Elixir?

1 Like

In general Elixir supports dynamic code loading, so this should be possible, although probably not easy. A completely different question is, if this is a good idea. I could also do something like GET /load-plugin/malicious that I uploaded with some, well, malicious intent. I cannot see how security could be provided in such system.


If you are looking something like me I know how to solve it.
After write some dependencies for my future project(s) I will create a site with CMS.
One thing is easy customize all you can see in web app.
I want to split CMS into multiple packages (and name them: “plugins”) and I want to disable and enable them with dependencies etc.
I want to solve this by creating a menus table in database with lots of info.
Menu target could be an article. After click on “disable articles” we can set plugin_disabled to true for each menu that targets on article. In that way we can filter a menus by this boolean and in Plug we can validate a menu link by checking this boolean and some other things (like user role).
It’s a lot lines of code to write, but it’s possible, but in this case you need to have all dependencies already installed. I think this is a good balance between configurable site and language/framework “hacks”.

1 Like