tree: f0cad960c6c9382cd5689f096a867ad02c9bf622 [path history] [tgz]
  1. .gcloudignore
  2. .travis.yml
  3. app.yaml
  4. CONTRIBUTING.md
  5. handler.go
  6. handler_test.go
  7. LICENSE
  8. main.go
  9. README.chrome_infra
  10. README.md
  11. vanity.yaml
go/src/infra/third_party/govanityurls/README.md

Go Vanity URLs

Go Vanity URLs is a simple Go server that allows you to set custom import paths for your Go packages. It also can run on Google App Engine.

Quickstart

Install and run the binary:

$ go get -u github.com/GoogleCloudPlatform/govanityurls
$ # update vanity.yaml
$ govanityurls
$ # open http://localhost:8080

chromium-go-url-redirector deployment

This application is deployed via the LUCI CD pipeline.

It's built into a tarball using //build/gae/infra/chromium-go-url-redirector.yaml.

These tarballs are then rolled into https://chrome-internal.googlesource.com/infradata/gae automatically, and releases can be made via the scripts/promote.py script there.

LEGACY: Google App Engine

NOTE: This section does not apply to the chromium-go-url-redirector deployment.

Install gcloud and install Go App Engine component:

$ gcloud components install app-engine-go

Setup a custom domain for your app.

Get the application:

git clone https://github.com/GoogleCloudPlatform/govanityurls
cd govanityurls

Edit vanity.yaml to add any number of git repos. E.g., customdomain.com/portmidi will serve the https://github.com/rakyll/portmidi repo.

paths:
  /portmidi:
    repo: https://github.com/rakyll/portmidi

You can add as many rules as you wish.

Deploy the app:

$ gcloud app deploy

That's it! You can use go get to get the package from your custom domain.

$ go get customdomain.com/portmidi

Running in other environments

You can also deploy this as an App Engine Flexible app by changing the app.yaml file:

runtime: go
env: flex

This project is a normal Go HTTP server, so you can also incorporate the handler into larger Go servers.

Configuration File

host: example.com
cache_max_age: 3600
paths:
  /foo:
    repo: https://github.com/example/foo
    display: "https://github.com/example/foo https://github.com/example/foo/tree/master{/dir} https://github.com/example/foo/blob/master{/dir}/{file}#L{line}"
    vcs: git

Path Configuration