We are launching all new Klivolks 3.0See what is new

Config & .env

config.C is ready before main() runs, reading env vars namespaced per app as {APPNAME}_HOST/{APPNAME}_PORT/{APPNAME}_SWAGGER_ENABLED (default true)/{APPNAME}_API_BASE_PATH (no default). .env, scaffolded at the app root, is read by a hand-rolled parser — no third-party dependency, consistent with the generated go.mod having none. A key already present in the real environment always wins over .env — it's a committed-or-not local default, never an override mechanism.

{APPNAME}_SWAGGER_ENABLED gates GET /swagger and GET /openapi.json — set it to false in production to 404 both. The check happens inside each handler, not by leaving the routes unregistered: Go's net/http.ServeMux treats GET / (every app's homepage route) as a subtree pattern that would otherwise silently catch an unregistered /swagger//openapi.json and serve the homepage instead of a 404. Every other route is unaffected.

{APPNAME}_API_BASE_PATH documents the path prefix an external gateway mounts this service under (e.g. /api/my-service), left unset by default for direct/local access. When set, openapi.Spec adds a relative servers[0].url entry to /openapi.json, so Swagger UI's "Try it out" requests resolve correctly whether the app is hit directly or through the gateway — it's purely documentational and never affects actual route registration or matching.