Blog

DreamFactory 2.9 Adds Git Services

Written by Kevin McGahey | July 6, 2018

DreamFactory 2.9 introduces two brand new services - GitHub and GitLab. This feature provides an easy way to connect to your project’s Git repositories and access them from DreamFactory. The real benefit here is the ability to create a live link to your DreamFactory server-side script that you manage on your own GitHub or GitLab account. 

Read more about DreamFactory's new features.

This blog post will cover the new GitHub and GitLab services themselves. There will be a separate blog post that will demonstrate how to create an event script (pre- and post-process scripts) and a custom scripting service that links to a script file on your GitHub or GitLab repository.

GitHub and GitLab services are native DreamFactory services and support role-service-access, live API documentation, and more. Once you've configured your Git services in DreamFactory, all the configuration details are hidden from your client. They're securely stored in your DreamFactory instance database. This provides a simple, standardized way to access your GitHub and GitLab repositories.

Git Service Configurations 

Configuring a Git service is as simple as configuring any other service in the DreamFactory admin console. Start by logging into the admin console, head over to the ‘Services’ tab, and click on the ‘Create’ button on the left sidebar. Use the ‘Service Type’ drop down to select ‘Source Control’ -> ‘GitHub Service’ / ‘GitLab Service’, complete the service configuration form and save it to create your service. The ‘Info’ tab on both GitHub and GitLab service looks like this.

Provide basic service information - Name, Label, and Description in the Info tab then click on the ‘Config’ tab.

GitHub Config 

Here’s what the GitHub ‘Config’ tab looks like.

In the ‘Config’ tab, provide the following configuration information:

  • Account/Organization - String. Required. GitHub account / organization / username (also known as vendor name for accessing all repositories under this).
  • Username - String. Optional. Your GitHub username.
  • Password - String. Optional. Your GitHub password.
  • GitHub Token - String. Optional. Your GitHub access token.

As you can see, username, password, and GitHub token are all optional. At minimum, you need an account/organization name to create a GitHub service. When you configure a GitHub service with just the account name, you can access only the public repositories under this account. If you configure the service with username and password OR with username and GitHub token, then you can also access the private repositories owned by your username account under your account name.

GitLab Config 

Here’s what the GitLab ‘Config’ tab looks like.

In the ‘Config’ tab, provide the following configuration information:

  • Base URL - String. Required. GitLab Base URL goes here. For example, for GitLab.com the Base URL is https://gitlab.{your-account-name}.com/api/v4/
  • GitLab Token - String. Required. You can provide your GitLab private token or an access token here.

Once you have your GitLab service configured you can access all your repositories using this service.

API Endpoints

After you have your GitHub or GitLab service configured, head over to the API Docs tab and select your service to reveal all its endpoints. The screenshot below shows all the endpoints for a GitHub service named ‘github’. The endpoints are exactly the same for a GitLab service. In the API Docs you can click on the individual endpoints to see all the usage details.

This blog post quickly showed how to use DreamFactory to connect to your own GitHub or GitLab repository. Check out the community forum to discuss this feature or let us know what you think in the comments! 

Read more about getting started with the DreamFactory API.