Documentation

Storage

PostgreSQL storage for self-hosted deployments.

Githook can persist SCM installation data in a SQL database via GORM. Two tables are used:

  • githook_installations for install/token metadata
  • git_namespaces for repositories (owner/name metadata per provider)

This is intended for multi-org setups where you need to track tokens and install metadata per account.

Multi-tenant scoping

Storage is tenant-aware. If the request context contains a tenant ID, all installation, namespace, and rule operations are scoped to that tenant. The server populates this automatically from the tenant_id claim in the auth token.

If no tenant ID is present, storage behaves as single-tenant.

Configuration

storage:
  driver: postgres
  dsn: postgres://githook:githook@localhost:5432/githook?sslmode=disable
  dialect: postgres
  table: githook_installations
  auto_migrate: true

Supported dialects:

  • postgres
  • mysql
  • sqlite (pure-Go via github.com/glebarez/sqlite)

Data model

Each installation record includes:

  • Provider
  • Account ID / name
  • Installation ID
  • Access / refresh tokens (if applicable)
  • Expiration time
  • Metadata JSON

GitHub App tokens are short-lived and should not be stored. GitLab/Bitbucket tokens can be stored when you control their lifecycle.