Skip to main content

OrdinaryConfig

Struct OrdinaryConfig 

Source
pub struct OrdinaryConfig {
Show 32 fields pub lifecycle: Option<TopLevelLifecycle>, pub domain: String, pub cnames: Option<Vec<String>>, pub canonical: Option<String>, pub redirects: Option<Redirects>, pub contacts: Option<Vec<String>>, pub hide_contacts: Option<bool>, pub version: String, pub storage_size: Option<u64>, pub default_timeout: Option<u16>, pub csp: Option<HttpCsp>, pub cors: Option<HttpCors>, pub runtime: Option<RuntimeMode>, pub hide_schema: Option<bool>, pub client_rendering: Option<bool>, pub obfuscation: Option<bool>, pub client_events: Option<bool>, pub port: Option<u16>, pub redirect_port: Option<u16>, pub logging: Option<LoggingConfig>, pub error: Option<ErrorConfig>, pub auth: Option<AuthConfig>, pub globals: Option<Vec<Global>>, pub secrets: Option<Vec<Secret>>, 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 fragments: Option<FragmentsConfig>, pub templates: Option<Vec<TemplateConfig>>,
}
Expand description

Config definition for an Ordinary Application

Fields§

§lifecycle: Option<TopLevelLifecycle>§domain: String

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

§cnames: Option<Vec<String>>

additional domains with a CNAME or ALIAS records pointing at the primary OrdinaryConfig::domain.

add a TXT record in the following format: ordinary=your.config.domain

§canonical: Option<String>

specify which of the domain or cnames is the “canonical” location.

this is useful for indexing and situations where you want to display the primary URL as text on the page itself (i.e. pick one of example.some.host, example.com, and www.example.com).

defaults to domain if cnames is empty. defaults to first cname in list if cnames are not empty.

§redirects: Option<Redirects>§contacts: Option<Vec<String>>

list of email addresses that can be used to contact the application owner or administrators.

§hide_contacts: Option<bool>

whether contacts should be hidden (defaults to true)

§version: String

Version of the site build.

§storage_size: Option<u64>

Storage size in bytes (rounded up to nearest OS page size).

§default_timeout: Option<u16>

Default request timeout.

Unit (seconds).

§csp: Option<HttpCsp>

HTTP Content Security Policy configuration.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP

“Base” defaults to default-src 'self'; and tacks on SHA-256 integrity hashes for all inlined scripts and styles (generated at build time) to script-src 'self' sha256-b64 and style-src 'self' sha256-b64, respectively.

https: is used when not running in --insecure mode.

§cors: Option<HttpCors>§runtime: Option<RuntimeMode>

Specifies runtime mode for application on the host.

If none is specified, defaults to Shared (or host default).

§hide_schema: Option<bool>

When set to true, {{ domain }}/.ordinary/schema is not addressable.

Note: this can break applications which depend on flags, and action/template query descriptors.

§client_rendering: Option<bool>

Include template rendering code in the client WASM.

§obfuscation: Option<bool>

Include E2EE handler code in the client WASM.

§client_events: Option<bool>

Include E2EE handler code in the client WASM.

§port: Option<u16>

Port to be used for standalone “run” instances.

§redirect_port: Option<u16>

port used for redirecting from http when standalone is running in secure mode.

§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

§secrets: Option<Vec<Secret>>

Secrets that can be used by actions or integrations.

§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).

§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.)

§fragments: Option<FragmentsConfig>

Configuration for the template fragments

§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.

Implementations§

Source§

impl OrdinaryConfig

Source

pub fn get(proj_path: &str) -> Result<OrdinaryConfig>

gets ordinary.json from project path and deserializes to struct.

Source

pub fn load_internal_compression(&mut self)

Source

pub fn for_send(&self) -> Result<OrdinaryConfig>

gets ordinary.json from project path, deserializes to struct and strips out all client-only values.

Source

pub fn validate(&self) -> Result<()>

check that all configuration values are internally consistent and no non-existent properties or fields are used.

Source

pub fn default_storage_size() -> Option<u64>

Source

pub fn has_ordinary_actions(&self) -> bool

Source

pub fn check_config_against_limits( &self, limits: &OrdinaryApiLimits, privileged_domains: &HashSet<String>, ) -> Result<()>

Check that all the configuration properties are within API specified limits.

Note: privileged domains are not subject to limitations checks.

Source

pub fn exec_lifecycle_script( proj_path: &Path, argument: &Option<String>, name: &str, when: &str, scripts: &Vec<Vec<String>>, ) -> Result<()>

Trait Implementations§

Source§

impl Clone for OrdinaryConfig

Source§

fn clone(&self) -> OrdinaryConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for OrdinaryConfig

Source§

impl Debug for OrdinaryConfig

Source§

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

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

impl Default for OrdinaryConfig

Source§

fn default() -> OrdinaryConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for OrdinaryConfig

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 OrdinaryConfig

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
Source§

impl ToSchema for OrdinaryConfig

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference utoipa::openapi::schema::Schemas for this type. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PartialSchema for T
where T: ComposeSchema + ?Sized,

Source§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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