Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// The listen address of the PocketBase server. If empty, a free port on
// 127.0.0.1 will be used.
Listen string `json:"listen,omitempty"`
// The data directory of PocketBase. If empty, a directory named `pb_data` in
// the Caddy data directory will be used. Refer to [Caddy data directory](https://caddyserver.com/docs/conventions#data-directory)
// for more information.
DataDir string `json:"data_dir,omitempty"`
// The allowed origins for the PocketBase server with respect to CORS.
// If empty, all origins are allowed.
Origins []string `json:"origins,omitempty"`
// contains filtered or unexported fields
}
App is a Caddy module that provides an embedded PocketBase server.
The module provides admin API endpoints under `/pocketbase/`:
- `POST /pocketbase/superuser` - Create a new superuser - `PUT /pocketbase/superuser` - Upsert a superuser - `PATCH /pocketbase/superuser` - Update superuser password - `DELETE /pocketbase/superuser` - Delete a superuser - `POST /pocketbase/superuser/{email}/otp` - Generate OTP for superuser
All the above endpoints require a JSON payload, except for the OTP endpoint. The JSON payload for the superuser endpoints is as follows:
{
"email_address": "...",
"password": "..."
}
The `DELETE` endpoint does not expect the `password` field.
Although PocketBase prints a URL in the logs to create the first superuser, the host part of the URL is not correct. You can either replace the host part with the host defined in your Caddy configuration, or use the admin API endpoint to create the first superuser.
The app can be configured in the Caddyfile through the `pocketbase` block in the global options section. Syntax:
pocketbase {
data_dir <path>
listen <addr>
origins <origin...>
}
If the block is omitted, the default values are used.
func (*App) CaddyModule ¶
func (a *App) CaddyModule() caddy.ModuleInfo
CaddyModule implements caddy.Module.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements an HTTP handler that proxies requests internally to a PocketBase server. It can be used in conjunction with the PocketBase app. If the PocketBase app is not explicitly configured, a PocketBase app with default config is used.
func (*Handler) CaddyModule ¶
func (h *Handler) CaddyModule() caddy.ModuleInfo
CaddyModule implements caddy.Module.