Skip to main content

GraphqlConfig

Struct GraphqlConfig 

Source
#[non_exhaustive]
pub struct GraphqlConfig {
Show 15 fields pub enabled: bool, pub path: String, pub introspection: Toggle, pub sdl: Toggle, pub mask_unexpected_errors: Toggle, pub allow_get: bool, pub max_body_bytes: usize, pub timeout_ms: u64, pub slow_operation_ms: u64, pub csrf_prevention: bool, pub batching: BatchingConfig, pub limits: LimitsConfig, pub subscriptions: SubscriptionsConfig, pub persisted_queries: PersistedQueriesConfig, pub uploads: UploadsConfig,
}
Expand description

The [graphql] section.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§enabled: bool

Kill switch. false mounts nothing (the routes 404).

§path: String

Mount path of the endpoint.

§introspection: Toggle

Allow introspection (__schema, __type). auto = on in the dev and test profiles, off elsewhere. __typename is always allowed.

§sdl: Toggle

Serve GET {path}/sdl. auto follows the effective introspection value: publishing the SDL is publishing the schema.

§mask_unexpected_errors: Toggle

Replace the message of any resolver error that does not carry an extensions.code with Internal server error (the original is logged). auto = off in dev/test, on elsewhere.

§allow_get: bool

Serve queries over GET {path}?query=…. Mutations over GET are always refused with 405.

§max_body_bytes: usize

Largest accepted request body, in bytes (multipart uploads are bounded separately by [graphql.uploads]).

§timeout_ms: u64

Per-operation execution timeout in milliseconds; 0 = none. Subscriptions are not timed out.

§slow_operation_ms: u64

Operations slower than this (milliseconds) are logged at WARN; 0 = never.

§csrf_prevention: bool

Require a preflight-forcing header (apollo-require-preflight, graphql-require-preflight or x-apollo-operation-name) on multipart requests, which browsers otherwise send cross-site without a CORS preflight.

§batching: BatchingConfig§limits: LimitsConfig§subscriptions: SubscriptionsConfig§persisted_queries: PersistedQueriesConfig§uploads: UploadsConfig

Implementations§

Source§

impl GraphqlConfig

Source

pub fn from_toml_str(text: &str, section: &str) -> Result<Self, ConfigError>

Parse the [section] table out of a whole autumn.toml document, with no profile layering and no environment overrides.

§Errors

Returns ConfigError for invalid TOML, unknown keys, wrong types, or values validate rejects.

Source

pub fn resolve(section: &str) -> Result<Resolved, ConfigError>

Resolve [section] from the host app’s configuration files and environment, exactly as Autumn core layers its own settings.

§Errors

Returns ConfigError when a contributing file cannot be read or parsed, when the merged section has an unknown or ill-typed key, or when a value is out of range.

Source

pub fn resolve_with_env( section: &str, env: &dyn Env, ) -> Result<Resolved, ConfigError>

Pure core of resolve, reading only env.

§Errors

See resolve.

Source

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

Reject values that would misbehave at runtime.

§Errors

Returns ConfigError naming the offending key.

Trait Implementations§

Source§

impl Clone for GraphqlConfig

Source§

fn clone(&self) -> Self

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 Debug for GraphqlConfig

Source§

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

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

impl Default for GraphqlConfig

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for GraphqlConfig

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 Eq for GraphqlConfig

Source§

impl PartialEq for GraphqlConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for GraphqlConfig

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 StructuralPartialEq for GraphqlConfig

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> JsonSink for T
where T: Serialize + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scoped for T
where T: Send + Sync + 'static,

Source§

fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>

Open a deferred ScopeQuery for this type. Resolves the registered scope at .load() time, not here.
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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