Struct AppConfig

Source
pub struct AppConfig {
Show 14 fields pub domain: String, pub version: String, pub port: Option<u16>, pub logging: Option<LoggingConfig>, pub error: Option<ErrorConfig>, pub auth: Option<AuthConfig>, pub globals: Option<Vec<Global>>, pub flags: Option<Vec<Flag>>, pub content: Option<Content>, pub models: Option<Vec<ModelConfig>>, pub integrations: Option<Vec<IntegrationConfig>>, pub actions: Option<Vec<ActionConfig>>, pub assets: Option<AssetsConfig>, pub templates: Option<Vec<TemplateConfig>>,
}
Expand description

Config definition for an Ordinary Application

Fields§

§domain: String

Domain name for the application to be run from the deployment environment.

§version: String

Version of the site build.

§port: Option<u16>

Port to be used for standalone “run” instances. Behaves as the “preferred port” when running off a deployment server, but is not a guaranteed assignment.

§logging: Option<LoggingConfig>§error: Option<ErrorConfig>

Configures error handling.

Note: If not included just the error message will be sent back as text.

§auth: Option<AuthConfig>

Auth config for the Ordinary application.

§globals: Option<Vec<Global>>

Global constants that can be accessed from templates

§flags: Option<Vec<Flag>>

Feature flags which can be referenced from templates to inform application behavior, and run experiments.

§content: Option<Content>

Definitions for static content “types”/object structure that can be used to inform template/page development (i.e one might define a “post” content definition, and then create a template for their blog).

§ordinary.json

{
    "content": {
        "file_path": "./content.json",
        "definitions": [
            {
                "name": "post",
                "fields": [
                    { "idx": 0, "name": "slug", "kind": "String", "indexed": true },
                    { "idx": 1, "name": "title", "kind": "String" },
                    { "idx": 2, "name": "body", "kind": "String" }
                ]
            }
        ]
    }
    "templates": [
        {
            "name": "post",
            "path": "./post.html",
            "mime": "text/html",
            "route": "/posts/{slug}",
            "content": [
                {
                    "name": "post",
                    "fields": [
                        { "name": "slug", "bind": { "Segment": { "name": "slug" } } },
                        { "name": "title" },
                        { "name": "body" }
                    ]
                }
            ]
        }
    ]
}

§content.json

[
    {
        "instance_of": "post",
        "fields": [
            { "name": "slug", "value": "post1" },
            { "name": "title", "value": "My First Post" },
            { "name": "body", "value": "This is a post about stuff." },
        ]
    },
    {
        "instance_of": "post",
        "fields": [
            { "name": "slug", "value": "post2" },
            { "name": "title", "value": "My Second Post" },
            { "name": "body", "value": "This is a post about other stuff." },
        ]
    }
]

§post.html

<h1>{{ post.title }}</h1>
<p>{{ post.body }}</p>
§models: Option<Vec<ModelConfig>>

Definitions for the models that will be stored in the Ordinary database.

§integrations: Option<Vec<IntegrationConfig>>

Definitions for the external APIs that will be integrated into the Ordinary application.

§actions: Option<Vec<ActionConfig>>

IO, access and language configuration for actions that are compiled to and executed as WebAssembly modules.

§assets: Option<AssetsConfig>

Specifies the asset directory and per-path configuration details for assets that require preprocessing (TypeScript, SCSS, JavaScript minification, etc.)

§templates: Option<Vec<TemplateConfig>>

Configuration for the templates/pages that the application will render. Each template is compiled to a WebAssembly module which accepts runtime arguments for models/content/integrations, and can be executed on either the server or the client.

With the option to render on the client, only the result of the server query needs to be sent, in a compact, optimized, format.

Currently all rendering is happening server-side, and only HTML is being sent.

In an ideal/future state multiple modes will be supported, even up to a full ‘noscript’ config.

Trait Implementations§

Source§

impl Clone for AppConfig

Source§

fn clone(&self) -> AppConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AppConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AppConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AppConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,