mod config#

module config#

Layered project configuration (file-first, no env for app settings).

Built with figment (the usual Rust 12-factor style layerer):

  1. Struct defaults (DEFAULT_PREFIX, empty Jira block)

  2. Discovered canonic.toml (walk up from cwd), or --config PATH

  3. Optional canonic.local.toml beside the discovered file (gitignored secrets)

  4. Explicit CLI overrides (--prefix)

Jira credentials live under [jira] in those TOML files — not JIRA_* env vars.

Variables

const DEFAULT_PREFIX: &str#

Default shared library prefix when no config/CLI override is set.

Functions

fn find_config_path(start: Option<&Path>) -> Option<PathBuf>#

Discover canonic.toml walking up from start (or cwd).

fn load_config(explicit: Option<&Path>, cli_prefix: Option<&str>) -> Result<CanonicConfig>#

Load layered config: defaults → canonic.tomlcanonic.local.toml → CLI.

fn load_config_file(path: &Path) -> Result<CanonicConfig>#

Load a single TOML file as the sole file layer (tests / tooling).

fn normalize_prefix(raw: &str) -> Result<String>#

ASCII letter/digit/- only; no leading/trailing -; non-empty.

fn resolve_prefix(cli_prefix: Option<&str>, config: &CanonicConfig) -> Result<String>#

Convenience: prefix after a full load (defaults + files + optional CLI).

Structs and Unions

struct CanonicConfig#

Loaded canonic project settings.

prefix: String#

Shared id / front-matter prefix (e.g. respresp-topic-slug.md).

jira: JiraSettings#

Optional free Jira REST settings.

source_path: Option<PathBuf>#

Path the primary TOML was loaded from (not serialized; set after load).

Implementations

impl CanonicConfig#

Functions

fn validate(mut self) -> Result<Self>#

Validate and normalize in place.

Traits implemented

impl Default for CanonicConfig#
struct JiraSettings#

Free-tier Jira connection settings (from canonic.toml / canonic.local.toml).

base_url: Option<String>#

Instance base URL, e.g. https://your-instance.atlassian.net.

email: Option<String>#

Cloud Free: account email for Basic auth with api_token.

api_token: Option<String>#

Cloud Free API token (with email).

auth_header: Option<String>#

Raw Authorization header value (e.g. Bearer for Server/DC). Wins over email/token.

Implementations

impl JiraSettings#

Functions

fn is_configured(&self) -> bool#

True when enough fields are present to attempt a connection.