2
0

docs(vault): add vault plugin architecture documentation

Document the architectural separation between gitcaddy-vault plugin and gitcaddy-server, including component locations, responsibilities, and the key rule for where to place interface types versus implementation code.
This commit is contained in:
2026-01-21 00:46:04 -05:00
parent 8aed522586
commit ecb9a7aae2

View File

@@ -0,0 +1,8 @@
{
"id": "note-1768974247220-lblqt44tj",
"title": "Server-Vault",
"content": "Vault Plugin Architecture Summary\n\n In gitcaddy-vault (plugin):\n\n | Component | Location | Purpose |\n |-----------------|-----------------------------|--------------------------------------------------------------------------------|\n | Routes/Handlers | routes/routes.go | Web UI and API endpoint handlers |\n | Services | services/*.go | Business logic (encryption, CRUD operations) |\n | Models | models/*.go | Database models (VaultSecret, VaultToken, VaultAuditEntry, VaultSecretVersion) |\n | Templates | templates/repo/vault/*.tmpl | HTML templates for web UI |\n | Locale | locale/*.ini, *.json | Translations |\n | Crypto | crypto/crypto.go | Encryption/decryption logic |\n | License | license/license.go | License validation |\n | Plugin Entry | plugin.go | Plugin registration, init |\n\n In gitcaddy-server (server):\n\n | Component | Location | Purpose |\n |------------------------|-------------------------|--------------------------------------------------------------------------------------------------------|\n | Plugin Interface Types | services/vault/vault.go | Shared types that plugin returns (e.g., Token, SecretVersion structs used in plugin service interface) |\n | Plugin Loading | Server's plugin system | Loads and registers the vault plugin |\n | Template Embedding | Build process | Vault templates get compiled into server binary |\n\n Key Rule:\n\n - Plugin defines behavior → vault plugin\n - Shared interface types that cross the plugin boundary → server's services/vault/\n\n Example:\n\n When you added CreatedUnix and UsedCount to Token:\n - The field definitions went in server/services/vault/vault.go (interface type)\n - The code that populates them went in vault/plugin_service.go (plugin implementation)",
"createdAt": 1768974247217,
"updatedAt": 1768974284744,
"tags": []
}