rb-gateway
Review Request #6831 — Created Jan. 25, 2015 and submitted — Latest diff uploaded
This is the beginnings of the rb-gateway project. It is meant to extend existing ReviewBoard functionalities to provide better support for repositories.
Currently, this is a wireframe set up using Google Go, and the git2go library for better Git support.
Structure is as followed:
- repository.go : Base repository structure and interface
- git_repository.go : The Git implementation of repository.go
- routes.go : Handles all web services and routing
- util.go : Handles configuration loading and repository lookup
- sample_config.json : Sample configuration file using .json format
- main.go : main() lives here, access logging
- auth.go : Basic Auth implementation
- session.go : Represents the current user sessionLocal use case:
1. Specify repo_name = path in config.json (see sample config)
2. Specify credentials in config.json
3. Specify the port you want the server to run on
2. After the server is started, go to ./localhost:<port>?repo=repo_name&id=sha
3. A file should download containing the requested blob.Link the old review request before pointing to rb-gateway: https://reviews.reviewboard.org/r/6825/
The server uses Basic Auth. Currently authenticating against a single user in the config file, this may need to change. Basic Auth expects the username:password combination in the /session path, and then encrypts that information and stores it in a session. The encrypted information is stored as a PRIVATE-TOKEN (similiar to the Gitlab API), and is expected in future http requests.
Routes are available for getting file blob and checking file existance based on either the Git revision, or the Git commit id, file path pair. It currently does not support other SCM aside from Git.
Authentication:
- curl -u username:password http://localhost:8002/session returns 200 OK and the PRIVATE-TOKEN
- Set up a repository succesfully in RB using a valid user / pass combo, and saw the access log in rb-gatewayFile and File Exists
- Tested the following paths via browser, review board, and curl for HEAD and GET methods; returned expected values for valid requests:
- http://localhost:8002/file?id=<revision-sha> (returned 200 OK, and file blob if GET)
- http://localhost:8002/file?commit=<commit>&path=<path> (returned 200 OK, and file blob if GET)