{"id":13503033,"url":"https://github.com/rust-cli/confy","last_synced_at":"2025-05-13T18:07:15.266Z","repository":{"id":39987826,"uuid":"126839895","full_name":"rust-cli/confy","owner":"rust-cli","description":"🛋 Zero-boilerplate configuration management in Rust ","archived":false,"fork":false,"pushed_at":"2025-05-12T23:31:20.000Z","size":115,"stargazers_count":957,"open_issues_count":15,"forks_count":63,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-13T00:24:22.520Z","etag":null,"topics":["cli","configuration"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audit.toml","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-26T14:17:52.000Z","updated_at":"2025-05-12T23:29:31.000Z","dependencies_parsed_at":"2024-06-18T03:37:57.225Z","dependency_job_id":"4ba6f8cd-aa4a-4cab-9b27-6390918f09d0","html_url":"https://github.com/rust-cli/confy","commit_stats":{"total_commits":89,"total_committers":28,"mean_commits":"3.1785714285714284","dds":0.7865168539325843,"last_synced_commit":"700337e5a3fbc12f4f49fc9b7ce449b1b71040ee"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fconfy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fconfy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fconfy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fconfy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-cli","download_url":"https://codeload.github.com/rust-cli/confy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253851071,"owners_count":21973674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","configuration"],"created_at":"2024-07-31T22:02:34.185Z","updated_at":"2025-05-13T18:07:15.236Z","avatar_url":"https://github.com/rust-cli.png","language":"Rust","readme":"# confy\n\n[![crates.io](https://img.shields.io/crates/v/confy)](https://crates.io/crates/confy)\n[![docs.rs](https://img.shields.io/docsrs/confy)](https://docs.rs/confy/)\n[![Discord](https://img.shields.io/badge/chat-Discord-informational)](https://discord.gg/dwq4Zme)\n\nZero-boilerplate configuration management.\n\nFocus on storing the right data, instead of worrying about how or where to store it.\n\n```rust\nuse serde_derive::{Serialize, Deserialize};\n\n#[derive(Default, Debug, Serialize, Deserialize)]\nstruct MyConfig {\n    version: u8,\n    api_key: String,\n}\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let cfg: MyConfig = confy::load(\"my-app-name\", None)?;\n    dbg!(cfg);\n    Ok(())\n}\n```\n\n## Confy's feature flags\n\n`confy` can be used with either `TOML`, `YAML`, or `RON` files.\n`TOML` is the default language used with `confy` but any of the other languages can be used by enabling them with feature flags as shown below.\n\nNote: you can only use __one__ of these features at a time, so in order to use either of the optional features you have to disable default features.\n\n### Using YAML\n\nTo use `YAML` files with `confy` you have to make sure you have enabled the `yaml_conf` feature and disabled both `toml_conf` and `ron_conf`.\n\nEnable the feature in `Cargo.toml`:\n\n```toml\n[dependencies.confy]\nfeatures = [\"yaml_conf\"]\ndefault-features = false\n```\n\n### Using RON\n\nFor using `RON` files with `confy` you have to make sure you have enabled the `ron_conf` feature and disabled both `toml_conf` and `yaml_conf`.\n\nEnable the feature in `Cargo.toml`:\n\n```toml\n[dependencies.confy]\nfeatures = [\"ron_conf\"]\ndefault-features = false\n```\n\n## Changing Error Messages\n\nInformation about adding context to error messages can be found at [Providing Context](https://rust-cli.github.io/book/tutorial/errors.html#providing-context)\n\n## Config File Location\n\n`confy` uses [ProjectDirs](https://github.com/dirs-dev/directories-rs?tab=readme-ov-file#projectdirs) to store your configuration files, the common locations for those are in the `config_dir` section, below are the common OS paths:\n\n| Linux | macOS | Windows |\n| --- | --- | --- |\n| `$XDG_CONFIG_HOME`/`\u003cproject_path\u003e` or `$HOME`/.config/`\u003cproject_path\u003e` | `$HOME`/Library/Application Support/`\u003cproject_path\u003e` | `{FOLDERID_RoamingAppData}`/`\u003cproject_path\u003e`/config |\n\nWhere the `\u003cproject_path\u003e` will be `rs.$MY_APP_NAME`.\n\n## Breaking changes\n\n### Version 0.6.0\n\nIn this version we bumped several dependencies which have had changes with some of the default (de)serialization process:\n\n* `serde_yaml` v0.8 -\u003e v0.9: [v0.9 release notes](https://github.com/dtolnay/serde-yaml/releases/tag/0.9.0). There were several breaking changes to `v0.9.0` and are listed in this release tag. Especially cases where previously numbers were parsed and now return `String`. See the release notes for more details.\n* `toml` v0.5 -\u003e v0.8: [v0.8 CHANGELOG](https://github.com/toml-rs/toml/blob/main/crates/toml/CHANGELOG.md#compatibility-1). Breaking change to how tuple variants work in `toml`, from the notes: \"Serialization and deserialization of tuple variants has changed from being an array to being a table with the key being the variant name and the value being the array\".\n\n### Version 0.5.0\n\n* The base functions `load` and `store` have been added an optional parameter in the event multiples configurations are needed, or ones with different filename.\n* The default configuration file is now named \"default-config\" instead of using the application's name. Put the second argument of `load` and `store` to be the same of the first one to keep the previous configuration file.\n* It is now possible to save the configuration as `toml` or as `YAML`. The configuration's file name's extension depends on the format used.\n\n### Version 0.4.0\n\nStarting with version 0.4.0 the configuration file are stored in the expected place for your system. See the [`directories`] crates for more information.\nBefore version 0.4.0, the configuration file was written in the current directory.\n\n[`directories`]: https://crates.io/crates/directories\n\n## License\n\nThis work is triple-licensed under MIT, MIT/X11, or the Apache 2.0 (or any later version).\nYou may choose any one of these three licenses if you use this work.\n\n`SPDX-License-Identifier: MIT OR X11 OR Apache-2.0+`\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cli%2Fconfy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-cli%2Fconfy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cli%2Fconfy/lists"}