diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-01-04 15:10:08 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-01-04 15:10:08 +0000 |
| commit | 59568eb9a925fd0131d5cd610361c34b8609b56f (patch) | |
| tree | 3d5c3d5e5a05533df5e01dc6bca8687f8f746d0f /README.md | |
| parent | 02d777a1675d12f0965e974ae8b0e2b1265210ea (diff) | |
Update documentation and Dockerfilev0.3.0
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 51 |
1 files changed, 30 insertions, 21 deletions
@@ -3,29 +3,38 @@ A thing that tells `go get` where to get Go packages and redirects users to https://godoc.org. -You need to set up the following environment variables for it to work: +## systemd Configuration -* `DEST` for the base URL that will be used to build the repository URL, -* `PREFIX` for the prefix that must be removed from your package name, - e.g. `golang.org/x/` for `golang.org/x/image`, and -* `VCS` for the type of VCS you are using, e.g. `git`. +`go-import-redirect` takes the following flags: -There are three modes of operation: +* `-addr` for the address on which `go-import-redirect` should listen. + It can either be a normal `IP:PORT` address or an absolute path to a + UNIX socket that will be created. Defaults to `localhost:8080`. See + https://golang.org/pkg/net/#Dial for more details. +* `-from` for the prefix that must be removed from your package name, + e.g. `golang.org/x/` for `golang.org/x/image`. +* `-to` for the URL that will be used to build the repository URL. +* `-vcs` for the type of VCS you are using, e.g. `git`. Defaults to + `git`. -1. **As a systemd service.** In this mode, it is recommended to enable - the companion systemd socket and configure that. systemd will only - start the service when needed. If you are not using the companion - systemd socket but rather the systemd service directly, you will need - to set the `ADDR` environment variable to tell go-import-redirect how - to listen for incoming connections. If `ADDR` is set and starts with - `/`, go-import-redirect will treat it as a UNIX socket path. If - `ADDR` is not set, it will default to `:8080`. See - https://golang.org/pkg/net/#Dial for more details. +It is recommended to enable the companion systemd socket and customize +it so systemd can start the service when needed and pass the socket to +`go-import-redirect`. -2. **Inside a Docker container.** In this mode, the port 8080 will be - exposed and no other environment variable besides the ones above need - to be set. +Likewise, you must customize the service definition to pass the right +flag values. -3. **As an AWS Lambda.** This is very similar to Docker. You will need - to set the environment variables above. Note that this version needs - to be compiled as a Linux binary and with the `aws` build tag set. +## AWS Lambda Configuration + +The AWS Lambda version requires the use of the following environment +variables: `FROM`, `TO`, and `VCS`. Those have the same semantics as the +flags described above. + +Note that this version needs to be compiled as a Linux binary and with +the `aws` build tag set. + +## Docker Configuration + +You can build the Docker image as usual, and pass the `-from`, `-to`, +and `-vcs` flags when you invoke `docker run`. The `-addr` flag is +already set to an appropriate value in the Dockerfile. |
