Documentation
¶
Index ¶
- Constants
- func AdminJobs(params AdminJobsParams) htmlbind.Fragment
- func Apps(params AppsParams) htmlbind.Fragment
- func Audit(params AuditParams) htmlbind.Fragment
- func ConfigureAuth(a *auth.Config, s *sessionconfig.SessionConfig, secret string, ...) error
- func Deliveries(params DeliveriesParams) htmlbind.Fragment
- func Forbidden(params ForbiddenParams) htmlbind.Fragment
- func GenerateProject(c GenProject, out io.Writer) error
- func Help(params HelpParams) htmlbind.Fragment
- func Inboxes(params InboxesParams) htmlbind.Fragment
- func Jobs(params JobsParams) htmlbind.Fragment
- func Main(o Options)
- func QuietPolls(next http.Handler) http.Handler
- func RegisterCommands()
- func RegisterConfig()
- func Run(ctx context.Context, o Options) error
- func SignIn(params SignInParams) htmlbind.Fragment
- func Tablet(params TabletParams) htmlbind.Fragment
- func Topology(params TopologyParams) htmlbind.Fragment
- type Account
- type AdminJobsParams
- type AllowedConfig
- type App
- func (a *App) Close() error
- func (a *App) Handler() http.Handler
- func (a *App) Manager() *docflow.Manager
- func (a *App) Outermost(next http.Handler) http.Handler
- func (a *App) StartHTTPS() (stop func(), err error)
- func (a *App) StartTimer(ctx context.Context) (stop func())
- func (a *App) Viewer(r *http.Request) *docflow.Viewer
- type AppsParams
- type AuditParams
- type Config
- type DeliveriesParams
- type ForbiddenParams
- type GenProject
- type HelpChapter
- type HelpParams
- type HelpSection
- type InboxesParams
- type JobsParams
- type Language
- type OIDCConfig
- type Options
- type SignInParams
- type TabletParams
- type TopologyParams
Constants ¶
const AssetsPath = "/_docflow"
AssetsPath is where Docflow's scripts and style are served: /_docflow/app.css, /_docflow/topology.js ….
Variables ¶
This section is empty.
Functions ¶
func AdminJobs ¶
func AdminJobs(params AdminJobsParams) htmlbind.Fragment
AdminJobs binds AdminJobs to its parameters, producing a renderable fragment.
func Apps ¶
func Apps(params AppsParams) htmlbind.Fragment
Apps binds Apps to its parameters, producing a renderable fragment.
func Audit ¶
func Audit(params AuditParams) htmlbind.Fragment
Audit binds Audit to its parameters, producing a renderable fragment.
func ConfigureAuth ¶
func ConfigureAuth(a *auth.Config, s *sessionconfig.SessionConfig, secret string, previous []string, secureCookies bool, o OIDCConfig) error
ConfigureAuth sets popcornweb's auth and [session] for the pages: what is Docflow's design (the OIDC mode, the paths a person signs in for, where the state of logins is kept, a sealed cookie as the session) rather than a deployment's choice. Outside dev it refuses to go on without the IdP or an admin rule. secret is DOCFLOW_SECRET: the session's keys are made of it when session.keyring.secret is not set; previous are the retired secrets (DOCFLOW_PREVIOUS_SECRETS), whose keys still read the sessions sealed with them.
Without an IdP in dev, nobody signs in: the pages say so.
func Deliveries ¶
func Deliveries(params DeliveriesParams) htmlbind.Fragment
Deliveries binds Deliveries to its parameters, producing a renderable fragment.
func Forbidden ¶
func Forbidden(params ForbiddenParams) htmlbind.Fragment
Forbidden binds Forbidden to its parameters, producing a renderable fragment.
func GenerateProject ¶
func GenerateProject(c GenProject, out io.Writer) error
GenerateProject writes the project GenProject names, telling out each file written and what to do next.
func Help ¶
func Help(params HelpParams) htmlbind.Fragment
Help binds Help to its parameters, producing a renderable fragment.
func Inboxes ¶
func Inboxes(params InboxesParams) htmlbind.Fragment
Inboxes binds Inboxes to its parameters, producing a renderable fragment.
func Jobs ¶
func Jobs(params JobsParams) htmlbind.Fragment
Jobs binds Jobs to its parameters, producing a renderable fragment.
func Main ¶
func Main(o Options)
Main runs the web application as a program's main: RegisterConfig (and the program's own registrations) first. It parses the configuration, answers a framework action (--generate-config, the health probe …), sets the sign-in up, opens the store, starts the timer and the ports, and serves until the process is told to stop; an error ends the program.
func QuietPolls ¶
QuietPolls keeps the polls of the topology page out of the access log: an answer that tells the page what it asked (200, or 304: nothing new) would be a line every few seconds for every page open, and the log would show nothing else. Another answer (a 401, a 5xx) is logged as every request is. It runs before the access log (pw.SlotAccessLog - 5), which writes through the backend it puts in the request's context.
func RegisterCommands ¶
func RegisterCommands()
RegisterCommands registers the subcommands of the program (gen-project), before the configuration is parsed, as RegisterConfig is called; Run answers them.
func RegisterConfig ¶
func RegisterConfig()
RegisterConfig binds Config to the "docflow" prefix and OIDCConfig to "oidc"; main calls it before the configuration is parsed.
func SignIn ¶
func SignIn(params SignInParams) htmlbind.Fragment
SignIn binds SignIn to its parameters, producing a renderable fragment.
func Tablet ¶
func Tablet(params TabletParams) htmlbind.Fragment
Tablet binds Tablet to its parameters, producing a renderable fragment.
func Topology ¶
func Topology(params TopologyParams) htmlbind.Fragment
Topology binds Topology to its parameters, producing a renderable fragment.
Types ¶
type AdminJobsParams ¶
type AdminJobsParams struct {
Account Account
}
type AllowedConfig ¶
type AllowedConfig struct {
Issuers []string `help:"issuers whose people get in"`
Domains []string `help:"email domains (or Google's hd) whose people get in"`
Groups []string `help:"groups whose members get in"`
}
AllowedConfig narrows who gets in; empty lets in anyone the IdP signs in. A person passes each list that is set (one of its values); admins always get in.
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the manager of the configured store, and the pages around it.
func Open ¶
Open opens the store and makes the manager. oidc is who of the people the IdP signs in gets in, and who is an admin (ConfigureAuth sets the sign-in itself); o is what a program of its own adds.
func (*App) Handler ¶
Handler is the application: the pages, and the manager's printers, API and devices' endpoints. The pages' scripts and style are the framework's /public mount's. Every page but /tablet is for a person signed in (ConfigureAuth); /admin/… and /audit for an administrator; /help is the manual. The pages are in the language of the person (localized), and POST /lang changes it; the API and the printers' endpoints are not translated.
func (*App) Manager ¶
Manager is the engine the pages serve, for a program's own pages and API (Options.Routes).
func (*App) Outermost ¶
Outermost is a middleware for the outermost slot of the framework's chain (main registers it): it keeps the chain inside it, which the HTTPS listener serves, so that a request over TLS gets what one over http does (the public tree, the sessions, the access log).
func (*App) StartHTTPS ¶
StartHTTPS listens on docflow.https_port, when it is set, until stop: with tls_cert_file and tls_key_file, or in development with a certificate of this computer signed by itself. A development run takes the next free port when that one is taken, as the framework does with the HTTP one.
func (*App) StartTimer ¶
StartTimer ticks every TickInterval while the process runs, and keeps the ports of the entry nodes open; serverless, or with no interval, a scheduler calls POST /api/tick instead (and there are no ports).
type AppsParams ¶
type AppsParams struct {
Account Account
}
type AuditParams ¶
type AuditParams struct {
Account Account
}
type Config ¶
type Config struct {
Records string `` /* 189-byte string literal not displayed */
Documents string `default:"" help:"store of the slips' documents (bbolt, s3, r2, gcs); empty for the records' store"`
Secret string `` /* 157-byte string literal not displayed */
PreviousSecrets []string `help:"retired secrets that still open what was signed with them, while a rotation goes on"`
AdminToken string `default:"" help:"bearer token of the API (/api), for scripts; people sign in with OIDC"`
TickToken string `default:"" help:"bearer token a scheduler calls POST /api/tick with"`
SubmitTokens []string `help:"name:secret pairs that may send jobs; none lets anyone send"`
TickInterval time.Duration `default:"30s" help:"how often the process ticks; 0 leaves it to a scheduler (serverless)"`
JobKeep time.Duration `default:"336h" help:"how long a job that ended is kept (its record, and its document once nothing shows it)"`
Serverless bool `default:"false" help:"refuse a store only one process can use, and tick only when called"`
FontDirs []string `help:"directories of the fonts of documents"`
NoSystemFonts bool `default:"false" help:"use only font_dirs"`
MaxDocumentMB int `default:"64" help:"largest document taken, in MiB"`
OnError []string `help:"nodes a job goes to when a send or a step fails for good at a node with no on_error edges (a notify node)"`
CredentialDir string `default:"" help:"directory of the credentials nodes name, a file each (DOCFLOW_CRED_<name> comes first)"`
SecureCookies bool `default:"true" help:"Secure on the devices' cookie (false only for plain http in development)"`
DeviceURL string `` /* 255-byte string literal not displayed */
HTTPSPort int `` /* 144-byte string literal not displayed */
TLSCertFile string `` /* 154-byte string literal not displayed */
TLSKeyFile string `default:"" help:"file of the private key (PEM) of tls_cert_file"`
SignKeyFile string `default:"" help:"file of the private key (PEM) that sign nodes sign documents with, as a witness"`
SignCertFile string `default:"" help:"file of the certificate of the signing key (PEM), followed by those of its chain"`
SignTSA string `default:"" help:"URL of a time-stamp authority (RFC 3161) that stamps the signatures of sign nodes"`
}
Config is the docflow table of config.{APP_ENV}.toml, or the DOCFLOW_* variables: how the engine runs. What it shows where (locations, printers, devices) is data, changed through the API.
type DeliveriesParams ¶
type DeliveriesParams struct {
Account Account
}
type ForbiddenParams ¶
type GenProject ¶
type GenProject struct {
Dir string `arg:"required" help:"directory of the new project, made if it is not there"`
Module string `help:"module path of the project (example.com/acme/docflow); the directory's name by default"`
Name string `help:"name of the program, its binary and its pw project; the last element of the module path by default"`
Bdf string `help:"a checkout of bdf the module is replaced with, as go.mod writes it (../bdf); none takes the module as released"`
Force bool `default:"false" help:"write over files that are there"`
}
GenProject is the subcommand gen-project: docflow gen-project <dir> [--module …] [--name …] [--bdf …] [--force].
type HelpChapter ¶
type HelpChapter struct {
Title string
Href url.URL
Current bool
Sections []HelpSection
}
type HelpParams ¶
type HelpParams struct {
Account Account
Title string
Language string
Chapters []HelpChapter
Body string
}
type HelpSection ¶
type InboxesParams ¶
type InboxesParams struct {
Account Account
}
type JobsParams ¶
type JobsParams struct {
Account Account
}
type OIDCConfig ¶
type OIDCConfig struct {
GroupsClaim string `default:"groups" help:"claim of the groups: a name, or a dotted path (realm_access.roles); a string or an array of them"`
GroupsPrefix string `default:"" help:"take only the groups of this prefix"`
Admins []string `help:"admins: issuer#subject, or a verified email; at least one admin rule outside dev"`
AdminGroups []string `help:"groups whose members are admins"`
// The roles short of an admin: topology changes the topology and what
// is at it (the admin pages); audit reads the audit log and every job.
TopologyAdmins []string `help:"people with the role topology: issuer#subject, or a verified email"`
TopologyAdminGroups []string `help:"groups whose members have the role topology"`
Auditors []string `help:"people with the role audit: issuer#subject, or a verified email"`
AuditorGroups []string `help:"groups whose members have the role audit"`
Allowed AllowedConfig
}
OIDCConfig is the [oidc] table, or the OIDC_* variables: who of the people the IdP signs in (popcornweb's [auth.oidc]: issuer, client_id, client_secret, redirect_url) gets in, their groups, and the admins.
type Options ¶
type Options struct {
// Public is the program's own public tree, which Popcorn Web serves
// at /public (its [assets] and manifest); nil for none. Docflow's
// own scripts and style are not there: they are served at AssetsPath
// by this package.
Public fs.FS
// Routes adds the program's own pages and API to the mux, after
// Docflow's are there: a page of its own, an API under a prefix of
// its own (not /api/<kind>/…, which are the nodes').
Routes func(mux *pw.ServeMux, app *App)
// AssetsDir serves Docflow's scripts and style from a directory (this
// package's public, while they are edited) instead of the copy
// embedded in the binary.
AssetsDir string
}
Options compose the web application around Docflow's own pages and API, for a program of its own (cmd/docflow sets none): what it adds to the one server.
type SignInParams ¶
type TabletParams ¶
type TopologyParams ¶
type TopologyParams struct {
Account Account
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package help is Docflow's manual: chapters written in Markdown beside this file, in English (en) and Japanese (ja), embedded in the binary and served by the web application at /help for everyone signed in.
|
Package help is Docflow's manual: chapters written in Markdown beside this file, in English (en) and Japanese (ja), embedded in the binary and served by the web application at /help for everyone signed in. |