woodglue.config¶
YAML-backed server configuration.
YAML-backed server configuration.
The config file lives at {data_dir}/woodglue.yaml and is required to run
the server. It declares storage, namespaces, documentation, UI, and engine
settings.
Logging for wgl start is driven by storage.log_file, storage.log_level,
storage.loggers, storage.log_max_bytes, storage.log_backup_count, and
the optional top-level logging: section; see woodglue.log_setup.
WoodglueStorageConfig
¶
Bases: StorageConfig
Extends lythonic StorageConfig with woodglue-specific storage and log rotation.
log_level defaults to INFO here rather than lythonic's DEBUG.
Source code in src/woodglue/config.py
log_file_explicit
property
¶
Whether log_file was given in the config, including an explicit null
(which disables the file log).
DocsConfig
¶
UiConfig
¶
Bases: BaseModel
Web interface settings. enabled serves the Console at /console/.
default names the UI that / redirects to: console or a key of uis.
Source code in src/woodglue/config.py
UiEntry
¶
Bases: BaseModel
A project UI served at /ui/<name>/, next to the Console. Exactly one of
these says what it is:
path: a Static UI, a directory of built files (relative to the data dir), such as a single-page app built withbase: "/ui/<name>/". Withspa_fallback, paths without a file extension that match no file returnindex.html, so client-side routes survive a reload; a missing.jsfile is still a 404.kind: streamlitwithapp: a Streamlit script that woodglue runs and proxies to (seewoodglue.apps.ui_process).command: any other server that woodglue runs and proxies to. Its arguments may use{port}(a free loopback port woodglue picks) and{base_path}(/ui/<name>); the server must listen on that port and serve under that path.upstream: the URL of a server run elsewhere, proxied to as is. It must serve under/ui/<name>too.
A Process-backed UI (all but path) gets the viewing User's identity in
request headers (see woodglue.ui_support), including a Delegated Token to
call the API as them. grants limits that token to the overlap of the
viewer's Grants and these, e.g. ["call reports", "read reports"], so a
compromised UI process cannot use everything an admin viewer may. Without
grants the token carries all of the viewer's Grants. ready_path is what
woodglue polls until the process answers; dev turns on the framework's
reload.
Opening any UI needs view on ui:<name> unless public.
Source code in src/woodglue/config.py
NamespaceEntry
¶
Bases: BaseModel
Per-namespace configuration. Exactly one of gref, file, or entries
must be set to specify how the namespace is instantiated.
However it is defined, the namespace is built and called with its
woodglue.mount.MountContext set as current_mount. A fragment needing the
instance data dir reads current_mount.get(None).data_dir rather than
taking an absolute path in its init config, so a copied woodglue.yaml
still points at its own instance.
Source code in src/woodglue/config.py
AdmitRules
¶
Bases: BaseModel
Who an Identity Provider may sign in. A person is admitted if any rule
matches. groups matches the provider's groups claim, or for GitHub an org
login (walnutgeek) or team (walnutgeek/core). anyone admits every
person the provider vouches for, which for a public provider such as Google
or GitHub means anyone on the internet.
Source code in src/woodglue/config.py
ProviderConfig
¶
Bases: BaseModel
One Identity Provider in auth.providers.
kind: oidccovers Google, Entra ID, Auth0, Okta, and other OpenID Connect providers;issueris the URL its discovery document hangs off.kind: githubuses GitHub's OAuth2;github_urlandgithub_api_urlpoint at GitHub Enterprise when needed.kind: trusted_proxy_jwttrusts a reverse proxy that signs each request's identity as a JWT inheader, e.g. Cloudflare Access (Cf-Access-Jwt-Assertion), Google IAP (x-goog-iap-jwt-assertion), or oauth2-proxy. The JWT is checked againstjwks_url,issuer, andaudience;email_claimandgroups_claimname the claims to read.kind: trusted_proxy_headertrusts a plainheadersuch asX-Forwarded-Email, with optionalname_headerandgroups_header(comma-separated), but only fromtrusted_sources(IPs or CIDRs). Anyone who reaches woodglue without the proxy can forge the header, sotrusted_sourcesis required.
With a trusted proxy there is no login page: the first request carrying a valid assertion signs the person in and starts a Session.
client_secret (and any other string) may reference environment variables
as ${NAME}. default_roles and the Roles that group_roles maps a
person's groups to are re-applied at every login, so removing someone from
a group takes their Role away at their next login.
Source code in src/woodglue/config.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
trust_email = False
class-attribute
instance-attribute
¶
Treat the email claim as verified even without email_verified: true.
Only for providers whose addresses the organization controls, such as a
single-tenant Entra ID, which does not send email_verified.
AuthConfig
¶
Bases: BaseModel
Authentication and authorization settings.
roles maps a Role name to its Grants, written as "<action> <pattern>"
strings (see woodglue.access). The admin Role is built in. When
enabled is false, every request runs as an anonymous Caller with all
Grants.
providers lists the Identity Providers people can sign in with (see
ProviderConfig); with none, the login page takes a Personal Access Token.
People whose verified email is in admins get the admin Role at login.
public_url is the server's address as browsers see it (e.g.
https://wg.example.com), used to build login callback URLs when woodglue
runs behind a proxy; by default it is taken from each request.
Source code in src/woodglue/config.py
WoodglueConfig
¶
Bases: BaseModel
Root configuration loaded from woodglue.yaml.
namespaces maps a prefix string to a NamespaceEntry dict with exactly
one of gref, file, or entries, plus optional expose_api and
run_engine flags.
uis maps a name to a project UI served at /ui/<name>/ (see UiEntry).
logging, when present, is a logging.config.dictConfig dict that replaces
woodglue's default logging setup (see woodglue.log_setup).
Source code in src/woodglue/config.py
expand_env(text, env)
¶
Replace ${NAME} references with values from env, so secrets stay out of
woodglue.yaml. A missing variable is an error rather than an empty string.
>>> expand_env("${ID}-x", {"ID": "abc"})
'abc-x'
>>> expand_env("${NOPE}", {})
Traceback (most recent call last):
...
ValueError: Environment variable NOPE is not set
Source code in src/woodglue/config.py
load_config(data_dir)
¶
Load WoodglueConfig from {data_dir}/woodglue.yaml.
Raises FileNotFoundError if the file does not exist.