Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }
Expand description

Runtime configuration including environment overrides and persisted settings.

Implementations§

Source§

impl Config

Source

pub fn load(inputs: &EnvInputs) -> Result<Self>

Load configuration from disk and environment.

§Errors

Returns an error if configuration directories cannot be created or files cannot be read.

Source

pub fn path(&self) -> &Path

Return the path to the configuration file.

Source

pub fn cache_dir(&self) -> &Path

Directory used for API response caching.

Source

pub fn data_dir(&self) -> &Path

Directory used for persistent data assets (templates, filters, etc.).

Source

pub fn templates_dir(&self) -> PathBuf

Directory where user templates are stored.

Source

pub fn filters_dir(&self) -> PathBuf

Directory storing reusable filter definitions.

Source

pub fn api_base_url(&self) -> Option<&str>

Return the computed API base URL, considering environment overrides.

Source

pub fn effective_api_base_url(&self) -> &str

Return the effective API base URL, falling back to the default value.

Source

pub fn default_workspace(&self) -> Option<&str>

Return the default workspace identifier.

Source

pub fn set_default_workspace(&mut self, workspace: Option<String>) -> Result<()>

Update the stored default workspace identifier.

§Errors

Returns an error if the configuration file cannot be saved to disk.

Source

pub fn default_assignee(&self) -> Option<&str>

Return the default assignee identifier.

Source

pub fn set_default_assignee(&mut self, assignee: Option<String>) -> Result<()>

Update the stored default assignee identifier.

§Errors

Returns an error if the configuration file cannot be saved to disk.

Source

pub fn default_project(&self) -> Option<&str>

Return the default project identifier.

Source

pub fn set_default_project(&mut self, project: Option<String>) -> Result<()>

Update the stored default project identifier.

§Errors

Returns an error if the configuration file cannot be saved to disk.

Source

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

Persist the in-memory configuration to disk.

§Errors

Returns an error when the configuration cannot be encoded or written to disk.

Source

pub fn store_personal_access_token( &mut self, token: &SecretString, ) -> Result<()>

Store the provided Personal Access Token in the configuration file.

§Errors

Returns an error if the configuration file cannot be updated.

Source

pub fn personal_access_token(&self) -> Option<SecretString>

Retrieve the Personal Access Token, taking environment overrides into account.

Source

pub fn delete_personal_access_token(&mut self) -> Result<()>

Remove any stored Personal Access Token.

§Errors

Returns an error when stored secrets cannot be removed.

Source

pub fn has_persisted_token(&self) -> bool

Determine whether a token is persisted in the configuration file.

Source

pub fn environment_token_available(&self) -> bool

Determine whether a token is provided by environment overrides.

Source

pub fn file_config_mut(&mut self) -> &mut FileConfig

Expose the underlying file configuration for mutation.

Trait Implementations§

Source§

impl Debug for Config

Source§

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

Formats the value using the given formatter. 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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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