diff --git a/README.md b/README.md index 5896924..d3c466b 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,78 @@ 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 +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 +``` + + + + + + + + + + + + + + + + + + + + + +
KeyRequiredDescription
hostoptionalHost name to use in meta tags. If omitted, uses the App Engine default version host or the Host header on non-App Engine Standard environments. You can use this option to fix the host when using this service behind a reverse proxy or a custom dispatch file.
pathsrequiredMap of paths to path configurations. Each key is a path that will point to the root of a repository hosted elsewhere. The fields are documented in the Path Configuration section below.
+ +### Path Configuration + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyRequiredDescription
displayoptionalThe last three fields of the go-source meta tag. If omitted, it is inferred from the code hosting service if possible.
reporequiredRoot URL of the repository as it would appear in go-import meta tag.
vcsrequired if ambiguousIf the version control system cannot be inferred (e.g. for Bitbucket or a custom domain), then this specifies the version control system as it would appear in go-import meta tag. This can be one of git, hg, svn, or bzr.
diff --git a/main.go b/main.go index ce9b452..6d06a81 100644 --- a/main.go +++ b/main.go @@ -24,10 +24,16 @@ import ( ) func main() { - if len(os.Args) != 2 { - log.Fatal("usage: govanityurls CONFIG") + var configPath string + switch len(os.Args) { + case 1: + configPath = "vanity.yaml" + case 2: + configPath = os.Args[1] + default: + log.Fatal("usage: govanityurls [CONFIG]") } - vanity, err := ioutil.ReadFile(os.Args[1]) + vanity, err := ioutil.ReadFile(configPath) if err != nil { log.Fatal(err) }