pub struct App {
pub root: PathBuf,
pub config: Config,
pub resources: BTreeMap<String, Resource>,
pub tls: Option<TlsPaths>,
pub functions_dir: PathBuf,
}Expand description
Everything the server needs, assembled from an app directory.
Fields§
§root: PathBufRoot of the app directory.
config: Config§resources: BTreeMap<String, Resource>All resources, keyed by name. Built-ins are included (and overridable).
tls: Option<TlsPaths>Present when an https/ directory with cert + key was found.
functions_dir: PathBufDirectory scanned for compiled function libraries.
Implementations§
Source§impl App
impl App
Sourcepub fn load(root: impl AsRef<Path>) -> Result<App>
pub fn load(root: impl AsRef<Path>) -> Result<App>
Load an app directory. Missing pieces fall back to safe defaults, so the smallest valid app is an empty directory.
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
What to call this app wherever it is named to a person — the admin dashboard’s header, the API docs, the CLI.
[app] name when the app gives itself one; the directory it lives in
otherwise, which is a filing decision (07-functions, backend) rather
than a name anybody should have to read. A blank name is not a name: it
would render as a heading with nothing in it, so it falls back too.
Sourcepub fn docs_title(&self) -> String
pub fn docs_title(&self) -> String
Title for the API docs: [docs] title when set, the app’s name
otherwise — so an app that names itself once is named everywhere.
Sourcepub fn resources_in_dependency_order(&self) -> Vec<&Resource>
pub fn resources_in_dependency_order(&self) -> Vec<&Resource>
Resource names in dependency order (referenced resources first), so a migrator can create tables without violating foreign keys.