Documentation
¶
Overview ¶
Command fakegithub serves githubtest's fake as a GitHub Enterprise Server built from a seed file, for an exercise that runs an app outside the Go test process, such as one in a container.
go run github.com/panyam/goapplib/storage/mounts/github/githubtest/cmd/fakegithub \ --seed seed.json --addr 127.0.0.1:7070 --listen 0.0.0.0:7071 --base-url http://host.docker.internal:7071
githubtest.Seed describes the seed file. The fake answers the REST API under /api/v3 as a GHES host does, and sign-in and raw files at its root. --addr serves the control requests that githubtest.Seeded.Control describes: GET / names the fake's addresses, the tags' commits and the App's key and installations, POST /approve approves a device code, and POST /push commits and delivers a push.
--listen and --base-url set where the fake listens and the origin of every URL it hands out, as githubtest.WithListener and WithBaseURL do. --hook-ca names a CA file the fake trusts when it delivers a webhook over TLS.
--tls-cert and --tls-key name a PEM certificate and its key. With both, the fake serves HTTPS on --listen, and the base URL defaults to https. The certificate has to name the address the app dials. An app outside loopback needs this, since oneauth's SetEnterpriseURL refuses a plain-HTTP Enterprise host there. The control address on --addr stays plain HTTP.
It is a test tool. Nothing in it is safe to expose beyond a test network.