{ DreamFactory: 'Blog' }

New GitHub integration offers direct import into DreamFactory

Posted by Carsten Jacobsen

Wed, Oct 19, 2016

One of my favorite features in DreamFactory is server-side scripting. Both event scripts and script services can really extend the DreamFactory platform, and customize it to your needs. If you are not familiar with DreamFactory server-side scripting, I recommend visiting the scripting documentation.

Previously, you had two ways of adding or updating your scripts in DreamFactory. You could either use the build-in code editor, or you could upload your script files. If you use your own scripts in production, you typically want to use source code version control, like GitHub, which adds another step to the process — checking out your script file from GitHub.

With the DreamFactory 2.3.1 release, we made loading a GitHub file a lot easier. You can now load script files from GitHub directly from the DreamFactory admin app.

Here's how:

Go to the Scripts page. Select the event you want to create or edit a script for, in this example the files GET pre-process. In the form where you select Script Type/Language, there’s a new button in the Upload a script file section that allows you to select a file from GitHub.

Click the Select File… button and a dialog will appear. Either type in the script file’s GitHub URL or paste it into the field. If the script file is in a public folder, just click the Upload button, and the script will be inserted into the code editor. Make your selections and click the the Save button. If the script file is in a private folder, you will be asked to provide your GitHub username and password for the selected repo. Your GitHub username and password will not be stored by DreamFactory, and you will need to provide your GitHub credentials every time you load script files from a private GitHub repo.

Scripting console

Add a GitHub URL

Authenticate to access the GitHub repository

 

That’s it.

This feature is easy to use and provides a convenient way to source control your scripts in GitHub. The feature is also implemented for script services, and it works the same way there. Select the Services page, Create service, select Script in the dropdown and the language of your choice. Script files can be uploaded from GitHub in both the Config and the Service Definition tabs.

Get started with DreamFactory with a free hosted DreamFactory development environment . Or, download and run it on the server, cloud, or desktop of your choice.

Custom Scripting Tutorials Product Updates

Weekly Digest