pub struct Config { /* private fields */ }Expand description
Runtime configuration including environment overrides and persisted settings.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load(inputs: &EnvInputs) -> Result<Self>
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.
Sourcepub fn data_dir(&self) -> &Path
pub fn data_dir(&self) -> &Path
Directory used for persistent data assets (templates, filters, etc.).
Sourcepub fn templates_dir(&self) -> PathBuf
pub fn templates_dir(&self) -> PathBuf
Directory where user templates are stored.
Sourcepub fn filters_dir(&self) -> PathBuf
pub fn filters_dir(&self) -> PathBuf
Directory storing reusable filter definitions.
Sourcepub fn api_base_url(&self) -> Option<&str>
pub fn api_base_url(&self) -> Option<&str>
Return the computed API base URL, considering environment overrides.
Sourcepub fn effective_api_base_url(&self) -> &str
pub fn effective_api_base_url(&self) -> &str
Return the effective API base URL, falling back to the default value.
Sourcepub fn default_workspace(&self) -> Option<&str>
pub fn default_workspace(&self) -> Option<&str>
Return the default workspace identifier.
Sourcepub fn set_default_workspace(&mut self, workspace: Option<String>) -> Result<()>
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.
Sourcepub fn default_assignee(&self) -> Option<&str>
pub fn default_assignee(&self) -> Option<&str>
Return the default assignee identifier.
Sourcepub fn set_default_assignee(&mut self, assignee: Option<String>) -> Result<()>
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.
Sourcepub fn default_project(&self) -> Option<&str>
pub fn default_project(&self) -> Option<&str>
Return the default project identifier.
Sourcepub fn set_default_project(&mut self, project: Option<String>) -> Result<()>
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.
Sourcepub fn save(&self) -> Result<()>
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.
Sourcepub fn store_personal_access_token(
&mut self,
token: &SecretString,
) -> Result<()>
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.
Sourcepub fn personal_access_token(&self) -> Option<SecretString>
pub fn personal_access_token(&self) -> Option<SecretString>
Retrieve the Personal Access Token, taking environment overrides into account.
Sourcepub fn delete_personal_access_token(&mut self) -> Result<()>
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.
Sourcepub fn has_persisted_token(&self) -> bool
pub fn has_persisted_token(&self) -> bool
Determine whether a token is persisted in the configuration file.
Sourcepub fn environment_token_available(&self) -> bool
pub fn environment_token_available(&self) -> bool
Determine whether a token is provided by environment overrides.
Sourcepub fn file_config_mut(&mut self) -> &mut FileConfig
pub fn file_config_mut(&mut self) -> &mut FileConfig
Expose the underlying file configuration for mutation.