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

app

package
v0.68.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package app wires the drive server: the core services over control.db, the HTTP server, and the plugs manager that runs it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTTL

func ParseTTL(s string) (time.Duration, error)

ParseTTL reads "30d" or any time.ParseDuration value. An empty string means no expiry and returns zero.

func Run

func Run(ctx context.Context, cfg config.Config, log zerolog.Logger, opts Options) error

Run serves until ctx is done or a plug fails.

Types

type Options

type Options struct {
	Info buildinfo.Info
}

type Services

type Services struct {
	Policies  *core.Policies
	Accounts  *core.Accounts
	Tokens    *core.Tokens
	Documents *core.Documents
	Shares    *core.Shares
	Sessions  *core.Sessions
	SignIn    *core.SignIn
	Sweeper   *core.Sweeper
	Outbox    core.OutboxStore
	// contains filtered or unexported fields
}

Services are the core services over one control.db.

func OpenServices

func OpenServices(ctx context.Context, log zerolog.Logger, cfg config.Config) (*Services, error)

func (*Services) Close

func (s *Services) Close() error

func (*Services) CreateToken

func (s *Services) CreateToken(ctx context.Context, email string, scope core.Scope, name string, ttl time.Duration) (secret string, token core.Token, bypassed string, err error)

CreateToken mints a token for email, creating the account when the email matches a policy. A zero ttl means the token never expires.

Minting is an operator action, so it creates the account even when the policy sets sign_up: false. That setting only governs self sign-up. When it did so, bypassed names the policy; otherwise bypassed is empty.

func (*Services) HTTP

func (s *Services) HTTP(baseURL string, trustedProxies []netip.Prefix) httpapi.Services

func (*Services) WriteAccounts

func (s *Services) WriteAccounts(ctx context.Context, w io.Writer) error

WriteAccounts prints one line per account with the policy that admits it, or "locked" when no policy does.

Jump to

Keyboard shortcuts

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