Skip to content

Config parser

The Rust backend in src-tauri/src/config_parser.rs implements a minimal INI parser (zero dependencies) for reading ~/.aws/config.

Parsing rules

  • Lines starting with # or ; are comments
  • Section headers match [section name]
  • Key-value pairs match key = value
  • Values can be quoted
  • Multi-line values are not supported

Mimic block markers

Generated SSO profiles are wrapped in markers:

ini
# BEGIN MIMIC GENERATED SSO PROFILES [mimic-org-name]
[profile 111122223333-AdminAccess]
sso_session = mimic-org-name
sso_account_id = 111122223333
sso_role_name = AdminAccess
region = eu-west-1
# END MIMIC GENERATED SSO PROFILES [mimic-org-name]

These markers allow Mimic to:

  1. Identify which profiles it manages
  2. Regenerate blocks without touching user-defined profiles
  3. Prune blocks when an organization is removed

Session name slug generation

The function session_name_for_identity_provider(org_name) generates the session name used in AWS config:

  • Lowercases all alphanumeric characters
  • Replaces non-alphanumeric characters with -
  • Strips leading/trailing dashes
  • Prepends mimic-

This function is duplicated in Rust (config_parser.rs) and TypeScript (src/lib/organizations.ts) — both must stay in sync.

Legacy sessions

Single-org setups from older versions used __legacy__ as the session marker. These are dropped on the first prune_identity_providers run.