0.1.14 • Published 2 years ago

cms-git-gateway v0.1.14

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
2 years ago

CMS Git gateway

This project is still a bit work in progress, not recommended for use in production. At the moment, only the gateway to GitHub is implemented - GitLab and Bitbucket will follow.

This project provides an alternative to Netlify's git-gateway: It provides a gateway to Git repositories with the credentials being stored within the gateway. Authentication is being done using an external OAuth server, authorization can be managed within the gateway.

The main difference is that this project provides an integrated user management interface (which is restricted to administrators) for assigning different access rights to different users for different websites.

Screenshot of the user management page Screenshot of the user management page

Users will be automatically added to the user list once they login. They can then be promoted as administrators at the user management page.

Screenshot of the access control page Screenshot of the website management page

On the website management page new websites can be added, together with the baking repository the gateway should refer to and the necessary access token. If you would like to register a second website using the same access token, you can clone existing sites. Write access to the site's repository via the gateway can be granted via the "Add User" button - this function is limited to users, which have already logged in the gateway once.


Setup

The project consists of two different parts, the server application (cms-git-gateway) and a client extension for supporting Netlify (cms-git-gateway-netlify).

Server

The gateway server can be simply run via node and customized by command line arguments:

ArgumentDescription
--port 3000Port which the gateway server should listen on
--hostingUrl http://localhostPublic url of the gateway server
--dbTypeDatabase provider to use (sqlite, mysql or postgres)
--dbHostHostname of the database server
--dbPortPort of the database server
--dbUsernameUser name for the database server
--dbPasswordPassword for the database server
--dbDatabaseFor SQLite: location of the database file; for others: database to select
--authServer https://demo.identityserver.ioUrl of the external OAuth server
--authClientId interactive.publicclient_id for accessing the OAuth server
--authClientSecret sEcREt123client_secret for accessing the OAuth server
--authPkceWith this flag being set, PKCE will be used for accessing the OAuth server.
--adminSub 11For testing purposes and initial setup, admin rights can be granted to the external OAuth user with the given sub.

Netlify extension (client)

First, setup the Netlify admin interface following Netlify's guide.

Make sure, that your config.yml file contains the following:

backend:
    name: git-gateway
    branch: master
    gateway_url: http://domain-of-the-gateway-server.com
    site_domain: http://domain-of-the-client.com

In addition, you have to include this project's client code to your admin's index.html file. Make sure, that you include it before the netlify-cms import:

<!-- Include the script, which injects changes necessary for accessing our gateway server -->
<script src="https://unpkg.com/cms-git-gateway-netlify"></script>

<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>