server

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: CC0-1.0 Imports: 17 Imported by: 0

Documentation

Overview

Package server hosts the prosa server runtime: config, HTTP wiring, Connect handlers, and storage adapters (Postgres + S3-compatible). The CLI talks to it via the generated Connect clients in gen/go/prosa/v1/prosav1connect.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// HTTP listen address. PROSA_LISTEN_ADDR (default ":7070").
	ListenAddr string

	// Postgres connection string. PROSA_DB_URL. Required.
	DBURL string

	// S3-compatible endpoint. PROSA_S3_ENDPOINT (e.g. "localhost:9000"
	// for MinIO; "s3.amazonaws.com" or "<account>.r2.cloudflarestorage.com"
	// for prod). Required.
	S3Endpoint string

	// PROSA_S3_BUCKET (default "prosa-raw").
	S3Bucket string

	// PROSA_S3_ACCESS_KEY / PROSA_S3_SECRET_KEY. Required.
	S3AccessKey string
	S3SecretKey string

	// PROSA_S3_USE_SSL (default false; flip to true for production).
	S3UseSSL bool

	// PROSA_S3_REGION (default "us-east-1"; MinIO ignores it, R2/B2
	// accept any string).
	S3Region string

	// PROSA_ADMIN_TOKEN — shared with prosa-panel; panel presents it as
	// Authorization: Admin <token> on Connect calls.
	AdminToken string

	// PROSA_PANEL_BASE_URL — public panel URL; BeginLogin appends
	// /cli/authorize?request_id=... for the CLI to open. Required.
	PanelBaseURL string
}

Config is the env-driven runtime configuration for prosa-server.

func Load

func Load() (Config, error)

Load reads the configuration from environment variables and validates that the required fields are populated. Defaults match the dev docker-compose.yml so a fresh checkout boots without extra exports.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server bundles Connect handlers with their Postgres and S3 dependencies.

func New

func New(ctx context.Context, cfg Config) (*Server, error)

New opens all backing stores and registers every Connect handler.

func (*Server) Close

func (s *Server) Close()

Close releases backing resources. Idempotent.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve binds the listener and serves Connect over h2c so dev / curl clients work without TLS. The painel / production deploy will sit behind a TLS-terminating proxy. Blocks until ctx is cancelled.

Directories

Path Synopsis
Package auth implements PKCE + localhost-callback login for the CLI and bearer middleware for all other RPCs.
Package auth implements PKCE + localhost-callback login for the CLI and bearer middleware for all other RPCs.
Package handlers binds the Connect-generated service interfaces to the prosa internal/server services (auth, sessions, devices).
Package handlers binds the Connect-generated service interfaces to the prosa internal/server services (auth, sessions, devices).
Package storage wraps the Postgres pool and the S3-compatible object store.
Package storage wraps the Postgres pool and the S3-compatible object store.

Jump to

Keyboard shortcuts

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