{"id":13500490,"url":"https://github.com/maurocordioli/viperus","last_synced_at":"2026-04-08T19:31:10.419Z","repository":{"id":39656999,"uuid":"231641961","full_name":"maurocordioli/viperus","owner":"maurocordioli","description":"Viperus - a cli configuration management toolbox","archived":false,"fork":false,"pushed_at":"2022-05-29T00:59:44.000Z","size":196,"stargazers_count":23,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-13T14:53:35.151Z","etag":null,"topics":["clap","configuration","rust","rust-crate","toml-config","yaml-configuration"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/viperus","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maurocordioli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-03T18:20:31.000Z","updated_at":"2024-09-13T19:08:38.000Z","dependencies_parsed_at":"2022-07-20T13:32:16.764Z","dependency_job_id":null,"html_url":"https://github.com/maurocordioli/viperus","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/maurocordioli/viperus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurocordioli%2Fviperus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurocordioli%2Fviperus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurocordioli%2Fviperus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurocordioli%2Fviperus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maurocordioli","download_url":"https://codeload.github.com/maurocordioli/viperus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurocordioli%2Fviperus/sbom","scorecard":{"id":628605,"data":{"date":"2025-08-11","repo":{"name":"github.com/maurocordioli/viperus","commit":"8271d3b3a1205ab8071f58cc217d412d1dcb33aa"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T07:12:49.440Z","repository_id":39656999,"created_at":"2025-08-21T07:12:49.440Z","updated_at":"2025-08-21T07:12:49.440Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31571599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["clap","configuration","rust","rust-crate","toml-config","yaml-configuration"],"created_at":"2024-07-31T22:01:03.125Z","updated_at":"2026-04-08T19:31:10.400Z","avatar_url":"https://github.com/maurocordioli.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"# viperus  [![Build Status](https://travis-ci.com/maurocordioli/viperus.svg?branch=master)](https://travis-ci.com/maurocordioli/viperus) [![Coverage Status](https://coveralls.io/repos/github/maurocordioli/viperus/badge.svg?branch=master)](https://coveralls.io/github/maurocordioli/viperus?branch=master)\n ~~go~~  rust configuration with fangs!\n\n`viperus` is an (in)complete commandline configuration solution for Rust applications.\nIt is heavly inspired by the wonderful go package \u003chttps://github.com/spf13/viper\u003e\nUse it at your own risk. ;-)\n\nno Go projects ~~has been harmed~~ are built consuming `viperus` :-)\n\n## Recent Changes\n* 0.1.10 adapters load cfg data from std:io::Read\n* 0.1.9  optional automatic prefixed environment  variable mapping, basic error propagation, cleaned dependency\n* 0.1.8  add cache feature, modular cargo  \"feature\" syntax\n* 0.1.5  add watch_all files with autoreload\n* 0.1.4  add format: java properties files\n* 0.1.3  better clap args: default values\n* 0.1.2  relaod config from files\n* 0.1.1  fixes dcs\n* 0.1.0  first release\n\n## What is viperus?\nViperus is a package, that enables program configuration via an extendable\ntypes system. Parameters can be incoprorated via cli parameters, environment\nviariables. Parameters may be declared in configuration files as well.\n\nGiven implementation can handle:\n\n* setting defaults\n* reading from config files. Given formats are parsed:\n  Dotenv, java-properties, JSON, TOML, YAML\n* reading from environment variables\n* reading from Clap command line flags\n* setting explicit values\n* reload of all files\n* watch config files and reload, if any source value changes in first place\n* caching\n\n## Why viperus?\n\nbeacuse I was migrating some go apps ... and there was missing a rust tool that supplies `Viper` ease of use :-)\n\nWhen config parameters are applied, Viperus uses the following decreasing precedence order:\n\n * explicit calls to `add`\n * clap flags values\n * config file parameters\n * environment variables\n * default parameters\n\n`viperus` merges configuration parameters from\n\n * clap optoins\n * dotenv\n * json files\n * toml files\n * yaml files\n\nin a single typed hash structure. The structure can be preset with default. Values are type checked.\n\nYou can create a standalone `viperus` object or \"enjoy\" a global\ninstance. The global instance is guarded with a Mutex to garantee\nthread safty.\n\nStructure elements of a static instance may be manipulated via the shadow functions\n\n * add\n * get\n * load_clap\n * load_file\n\n```rust\n// add a dotenv config file. keys defautls to the env variables\nviperus::load_file(\".env\", viperus::Format::ENV).unwrap();\n\n// add another file\nviperus::load_file(\"user.env\", viperus::Format::ENV).unwrap();\n\n// automatically map env variable staring with \"TEST_\" to config keys\nviperus::set_env_prefix(\"TEST_\");\nviperus::automatic_env(true);\n\n// watch config parameters and autoreload changed values\nviperus::watch_all();\n\n// enable caching -- file reload invalidates cache\n// the cache is thread safe for the global \"static\" instance\nviperus::cache(true);\nlet ok=viperus::get::\u003cbool\u003e(\"TEST_BOOL\").unwrap();\n```\n\n** Sidenote:  Yes I konw globals are evil. Inspiration was taken form the go package `viper` that is taking this route ....\nIf you dislike globals, or other preset defaults, go ahead and opt-out like this:\n\n```cargo\ncargo build --release --no-default-features --features \"cache, fmt-clap, fmt-env, fmt-javaproperties, fmt-yaml, fmt-toml, notify, watch\"\n```\n\n## caching\nEnable caching and you will gain a x4 speed-up.\nCache is only thread safe if you use a global instance that is guarded with an arc mutex.\n\n```rust\n\tviperus::cache(true);\n```\n\nThe caching is invalidated, if you\n * reload any file with an excplicit ``` viperus::reload() ```\n * parameter changes inside a file, that is observed with the  `watch` feature\n\n## logging/debug\n\nThe crate uses `log` facade. Testing is supported via the `env_logger` crate.\nyou can set the env variable to RUST_LOG=viperus=[DEBUG LEVEL] with\n\n[DEBUG LEVEL] = info|warning|debug  or RUST_LOG=[DEBUG LEVEL]\n\n## features\nThe crate may be adopted using cargo's \"feature\" semantic. The default enables all supported features:\n\n*  feature = \"fmt-[format]\" with [format] in 'clap, env, javaproperties, json, toml, yaml' enabling the relative format\n*  feature = \"global\" enabling the global tread safe configuration\n*  feature = \"watch\" enabling the automatic file reload ( prerequisite: feature=global)\n*  feature = \"cache\" enabling caching\n\nsingle featues could be activated in a selective way  via cargo.toml\n\n```toml\n[dependencies.viperus]\nversion = \"0.1.8\"\n\n# do not include the default features, and optionally\ndefault-features = false\n\n# cherry-pick individual features\nfeatures = [\"global\", \"cache\",\"watch\",\"fmt-yaml\"]\n```\n\n## Tests\nAll available integration tests are put into the subdirectory `tests`.\nReading the source code may help to get into the inner logic.\n\n```\ncargo test\n```\n\n## Examples\n\nInside the example subdirectory there is a reference implementation that consumes a yaml configuration file.\n\nCompile and execute it like this:\n\n```\ncargo run --example cli-clap-yaml --\n```\n\nSince the `cli-clap-yaml` call does **not** define any commandline\narguments, the revealed parameters inside the config file will be parsed out.\n\nIn a second run, we call this example providing commandline parameters:\n\n```\ncargo run --example cli-clap-yaml -- -c ./example.conf -u http://nowhere/api/v1\n```\n\nSince the `cli-clap-yaml` does call **with** commandline\narguments, the revealed parameters inside the config file are overwritten.\n\n```rust\n\nlet matches = App::new(\"My Super Program\")\n\t\t\t\t .arg(Arg::with_name(\"v\")\n\t\t\t\t .short(\"v\")\n\t\t\t\t .multiple(true)\n\t\t\t\t .help(\"Sets the level of verbosity\"))\n\t\t\t\t .get_matches();\nlet mut v = Viperus::new();\n\n//enable clap\nv.load_clap(matches);\n//enable a yaml json toml file\nv.load_file(\u0026path!(\".\",\"assets\",\"test.yaml\"), Format::YAML).unwrap();\nv.load_file(\u0026path!(\".\",\"assets\",\"test.json\"), Format::JSON).unwrap();\nv.load_file(\u0026path!(\".\",\"assets\",\"test.toml\"), Format::TOML).unwrap();\nv.load_file(\u0026path!(\".\",\"assets\",\"test.properties\"), Format::JAVAPROPERTIES).unwrap();\n//link the \"v\" clap option to the key \"verbose\"\nv.bond_clap(\"v\",\"verbose\");\n\n\n//add an explicit overload\nv.add(\"service.url\", String::from(\"http://example.com\"));\ndebug!(\"final {:?}\", v);\n\n//get a typed key\nlet s: \u0026str = v.get(\"service.url\").unwrap();\nassert_eq!(\"http://example.com\", s);\n\n//get a bool from configs or app args\nlet fVerbose=v.get::\u003cbool\u003e(\"verbose\").unwrap();\nassert_eq!(true, fVerbose);\n```\n\n## Todo\n[ ] remote configs\n[ ] better error propagation\n[ ] stabilize api\n[ ] improve documentation and examples\n[ ] improve my rust karma\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurocordioli%2Fviperus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaurocordioli%2Fviperus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurocordioli%2Fviperus/lists"}