Help us shape the future of Go! Take the 2026 Go Developer Survey

consoleserver

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package consoleserver serves the admin console: first-admin setup, admin sign-in, account and invite administration and the app's settings over the server's database. It composes the identity service for the console audience; disabling or deleting an account notifies every diffx-server replica through the store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compose

func Compose(store *pgstore.Store, settings Settings) *identityservice.Service

Compose returns the identity service for store with the console's Google client, whose callback is on the console origin.

func Handler

func Handler(store *pgstore.Store, settings Settings, assets fs.FS) http.Handler

Handler serves the console API, probes and assets.

func Open

func Open(ctx context.Context, databaseURL string) (*pgstore.Store, error)

Open connects to and migrates the server's database, waiting for it to start.

func ResetPassword

func ResetPassword(ctx context.Context, store *pgstore.Store, settings Settings, email string) (string, error)

ResetPassword issues a reset link for an account email, for offline recovery.

func Run

func Run(ctx context.Context, settings Settings, ready func(string)) error

Run serves the console until ctx ends. While no admin exists, each start logs a one-time setup link that creates the first admin.

Types

type GoogleSettings

type GoogleSettings struct {
	ClientID     string
	ClientSecret string
	// contains filtered or unexported fields
}

type Settings

type Settings struct {
	Listen string
	// DatabaseURL selects the server's Postgres database; never logged.
	DatabaseURL string
	// PublicURL is the console's browser-facing origin, used in the setup link,
	// admin reset links and the Google callback. Unset, links use the listener.
	PublicURL string
	// AppURL is the app's origin, used in invite and member reset links.
	AppURL          string
	InsecureCookies bool
	// Google enables console Google sign-in for existing admins and Google
	// first-admin setup; it requires PublicURL.
	Google *GoogleSettings
	// ClientIPHeader names the header a trusted ingress sets to the client IP.
	// Non-empty enables authentication rate limiting shared by every replica.
	ClientIPHeader string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL