New GitHub Integration Offers Direct Import into DreamFactory
Have you ever wanted to learn how to load script files from GitHub directly into the admin app? You've come to the right place.
Join the DZone community and get the full member experience.Join For Free
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 built-in code editor or you could upload your script files. If you use your own scripts in production, you typically want to use some type of 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.
1. Go to the Scripts Page
Select the event for which you want to create or edit a script. In this example, this is the files that GET pre-processes. 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.
2. Click the Select File… Button
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 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.
And 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.
Published at DZone with permission of Carsten Jacobsen, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.