Moving global script functions to a server file
I would like to move the global scripts I have created to an external file(s) on the server to help with deployment and source control. Is this possible? Where/how would the file reside on the server? How would the file be included when the app was loaded and how would I call the functions in the file?
PS: mango v3.5.6
CraigWeb last edited by
The global scripts are stored in the global scripts database table. You could store the scripts on a file in the filestore but you would need to import the script via JSON each time you want to update it.
MattFox last edited by
@iperry said in Moving global script functions to a server file:
How would the file be included when the app was loaded and how would I call the functions in the file?
Sorry to barge in here, but I'm getting mixed signals, are you wanting to use global scripts that you have in the mango system for scripts and meta points to call on or are you talking about the mangoUI?
Hi Matt, Craig
The functions I have created in the global scripts are being used by meta points and scripting data sources. I was not intending for them to be used by the mangoUI.
My hope was that I could move the global scripts and have them reside in a file(s) on the server outside the database. Currently, if I want to version control the global scripts, I need to export them using the configuration tool, save that file and then commit to source control. Comparing versions is a challenge as the scripts are each saved as a string in a JSON object. Any comparison tools shows the entire string has changed.
Updating (or creating) an app would then just require that I copy the file over instead of importing using the configuration tool. One less step to manage.
I'm hoping I'm making sense :)
terrypacker last edited by
If all you want is version control you can leverage our Audit Trail. The UI isn't highly evolved for it yet but it does let you look at the history for most of our configuration. See my images. I created a global script called 'Example' and then edited it once to add a second line of code.
Note we only save the changes to the object instead of the whole thing each time. For global scripts this will likely only be the latest version of the script.
The general design was such that we can eventually allow an admin to 'restore' something to what it was at a previous date. The Dashboard designer uses this functionality to track revisions.
Thanks for pointing me towards the audit trial. I hadn't realized what elements were tracked here.
However, the audit trail doesn't offer any comparison tools, version tagging, etc that source control app would, like Github. This was my intention for saving the global scripts to an external file.