Configuration
Every setting of an installation is a line in .env. After a change, run docker compose up -d; Compose restarts
only the services the change affects.
Addresses
| Setting | Meaning |
|---|---|
APIGIT_APP_URL | The address users open. It is written into links, e-mails, git clone addresses and sign-in redirects, so it must be the address users actually use, with https:// when your proxy serves TLS |
APIGIT_DOCS_URL | The address of the viewer. Every published document loads its scripts and fonts from here |
APIGIT_WEB_BIND, APIGIT_VIEWER_BIND | Where the two web containers listen on the server (default 127.0.0.1:8080 and 127.0.0.1:8081) |
APIGIT_TRUSTED_PROXIES | Address ranges of your proxy, as seen from the containers (default: private address ranges). X-Forwarded-For and X-Forwarded-Proto are accepted only from these |
If you change APIGIT_APP_URL after users have set up single sign-on or cloned repositories, the callback address at
your identity provider and the remotes of existing clones must be changed too.
Published documents on their own host names
A published document can be given its own host name in its settings (Custom domain). For it to work:
- Point the name at the server (DNS).
- Route the name to the viewer (
127.0.0.1:8081) in your proxy, with its certificate, passingHoston unchanged.
The application shows the host of APIGIT_DOCS_URL as the CNAME target. A document without its own host name is read
in the application, at /apidoc/<owner>/<repository>.
Mock servers
A mock server answers on <its name>.<APIGIT_MOCK_HOST>. Point a wildcard DNS record at the server and route the
wildcard to the mock container (127.0.0.1:8082) in your proxy, with a wildcard certificate, passing Host on
unchanged.
| Setting | Default | Meaning |
|---|---|---|
APIGIT_MOCK_HOST | required | The host name mock servers answer under, for example mock.example.com. Add a port only when it is not the scheme’s default |
APIGIT_MOCK_SCHEME | https | How the application writes a mock server’s address: https or http |
APIGIT_MOCK_BIND | 127.0.0.1:8082 | Where the mock container listens on the server |
APIGIT_INTERNAL_API_TOKEN | required | A secret shared by the backend and the mock container (openssl rand -hex 32) |
APIGIT_MOCK_WORKER_MAX_CHILDREN | 20 | How many code-based mock servers can be running at the same moment; one that has been idle for five minutes makes room |
APIGIT_MOCK_WORKER_MEMORY | 2g | Memory limit of the container that runs mock scripts; each mock server’s script has a heap of 160 MB |
There are two kinds of mock server, as on APIGit Cloud: spec-based (answers generated from an API document) and
code-based (scripts in the repository’s apigit-mock folder). A request to a code-based mock server has ten seconds;
a script that takes longer is stopped and the request answers 500. There is no monthly limit on calls.
Request logs. Each call to a mock server is logged: the time, the request and the response with their headers and bodies (credentials are removed), and what a script printed. The log is shown on the mock server’s page. It is kept in the installation’s database for 30 days; older entries are deleted once a day.
| Setting | Default | Meaning |
|---|---|---|
APIGIT_MOCK_LOG | on | off keeps no request log; the application then says that logs are not kept |
APIGIT_MOCK_LOG_RETENTION_DAYS | 30 | How many days an entry is kept. 0 keeps every entry |
Things to know:
- The log is part of the database, so it is in the database backup and it takes database space: an entry is usually a few kilobytes and at most 256 KB (a larger one is stored without its bodies). A mock server that receives heavy traffic all day can add gigabytes within the retention period; shorten the period, switch the log off, or use a search service as below.
- A call is answered before its entry is stored. Entries are written in batches about once a second; if the backend cannot be reached, the entries of that moment are lost and the mock server keeps answering.
- Deleting a mock server deletes its log.
A search service instead of the database. For large volumes, or to search the log with your own tools, give the installation an OpenSearch or Elasticsearch service. The log then goes there and not to the database, and the retention is whatever you configure on that service.
| Setting | Meaning |
|---|---|
APIGIT_SEARCH_URL | The address of the search service, for example https://search.example.internal:9200 |
APIGIT_SEARCH_USERNAME, APIGIT_SEARCH_PASSWORD | Its credentials, if it asks for them (basic authentication) |
Entries already in the database stay there when you switch to a search service, are no longer shown, and are deleted as they pass the retention period.
Try it
“Try it” in an API reference sends the reader’s request through the tryit container, at
<APIGIT_APP_URL>/_tryit, so it works for APIs the reader’s browser could not call directly. An author switches it on
per published document.
| Setting | Default | Meaning |
|---|---|---|
APIGIT_TRYIT_ALLOW_HOSTS | empty | Empty: the public internet only; addresses of private networks are refused. Otherwise only what is listed, separated by commas: host names, .suffixes (every name under it), address ranges, @public (every public address), @private (every private one). For example @public,.api.example.com,10.20.0.0/16 |
APIGIT_TRYIT_DENY_CIDRS | empty | Address ranges refused in addition |
Always refused: the server’s own loopback addresses, 0.0.0.0/8 and link-local addresses (which include cloud metadata services).
Security explains what that leaves open.
Accounts and sign-in
| Setting | Default | Meaning |
|---|---|---|
APIGIT_DISABLE_REGISTRATION | true | true: users are created by an administrator or by single sign-on. false: the sign-up page is open to anyone who can reach it, up to the licence’s seat count |
APIGIT_REGISTER_EMAIL_CONFIRM | false | true: a new password account must confirm its e-mail address. Needs mail |
Single sign-on is configured in the application, on the Admin page (authentication sources: OpenID Connect,
LDAP) and under Licence → SSO. The callback address to register at an OpenID Connect provider is
<APIGIT_APP_URL>/api/v1/users/oauth2callback/<source name>.
Sign-in has no CAPTCHA in this edition; repeated failed sign-ins from one address are rate limited.
| Setting | Meaning |
|---|---|
APIGIT_MAIL_ENABLED | true to send mail |
APIGIT_SMTP_HOST, APIGIT_SMTP_PORT | Your SMTP server (port 587 with STARTTLS by default) |
APIGIT_SMTP_USER, APIGIT_SMTP_PASSWORD | Its credentials, if it asks for them |
APIGIT_MAIL_FROM | The sender, for example "APIGit <apigit@example.com>" |
Without mail, password reset and e-mail confirmation are not available; an administrator sets passwords.
Your own PostgreSQL or Redis
The bundled postgres and redis containers are enough for one machine. To use your own:
| Setting | Meaning |
|---|---|
APIGIT_DB_HOST, APIGIT_DB_NAME, APIGIT_DB_USER, APIGIT_DB_PASSWORD, APIGIT_DB_SSL_MODE | PostgreSQL 14 or later; an empty database owned by that user |
APIGIT_REDIS_URL | Redis 7 or Valkey, for example redis://redis.example.internal:6379. Databases 0 to 3 are used |
Then stop the bundled service you replaced, with a compose.override.yaml:
services:
postgres:
profiles: ["unused"]
backend:
depends_on: !reset [redis]Where data is kept
| Volume | Contents |
|---|---|
backend-data | Git repositories, uploaded files, the installed licence, the generated server keys |
mock-data | The files and the saved state of published mock servers. Can be rebuilt by publishing the mock servers again; their saved state would be lost |
postgres-data | The database |
redis-data | Sessions and queues; can be lost without losing data (users sign in again) |
Logs and monitoring
All services log to standard output: docker compose logs -f backend. docker compose ps shows each
service’s health (the backend’s own check covers its database), and GET /api/v1/version on the web port answers
with the version when the application port reaches the backend. APIGIT_LOG_LEVEL sets the backend’s level (info by default).