Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub settings: Settings,
    pub commands: Commands,
    pub wrappers: WrapperConfig,
    pub git: GitConfig,
    pub cargo: CargoConfig,
    pub kubectl: KubectlConfig,
    pub gh: GhConfig,
}
Expand description

Top-level configuration, produced by merging embedded defaults with an optional user overlay from ~/.config/cc-toolgate/config.toml.

Fields§

§settings: Settings

Global settings (e.g. escalate_deny).

§commands: Commands

Flat command-to-decision mappings (allow, ask, deny lists).

§wrappers: WrapperConfig

Wrapper commands that execute their arguments as subcommands.

§git: GitConfig

Git subcommand-aware evaluation rules.

§cargo: CargoConfig

Cargo subcommand-aware evaluation rules.

§kubectl: KubectlConfig

kubectl subcommand-aware evaluation rules.

§gh: GhConfig

GitHub CLI (gh) subcommand-aware evaluation rules.

Implementations§

Source§

impl Config

Source

pub fn default_config() -> Self

Load the default embedded configuration.

Source

pub fn load() -> Self

Load configuration with resolution order:

  1. Start with embedded defaults
  2. Merge user overlay from ~/.config/cc-toolgate/config.toml (if exists)

User config merges with defaults: lists extend, scalars override. Set replace = true in any section to replace its defaults entirely. Use remove_<field> lists to subtract specific items from defaults.

Trait Implementations§

Source§

impl Debug for Config

Source§

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

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

impl<'de> Deserialize<'de> for Config

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 Config

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> 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, 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>,