1 unstable release
Uses old Rust 2015
0.1.0 | Dec 5, 2017 |
---|
#17 in #reduce-boilerplate
Used in 2 crates
12KB
180 lines
NS Env Config
API Docs | Usage | Github | Crate
An env_logger-inspired one-stop configuration for name resolution based on abstract-ns.
Goals:
- Make bootstrapping of small to medium size apps easier
- Provide a standard way for configuring name resolution in rust ecosystem
Features:
- Standard libc-based name resolution by default (using threads)
- [TODO] Feature-gated other resolvers (async, consul,...)
- If compiled in, resolvers are enabled by
RUST_NS=resolver_name
- Sane defaults for resolvers
- Subscriptions are enabled by default (using polling if not available)
- Some options configured from env (
RUST_NS=resolver_name:option=value
) - [TODO] Suffix-based resolution (
RUST_NS=std,consul=consul-resolver
)
Non-goals:
- Covering every other way to resolve names
- Covering all the settings of every resolvers
Usage
Standard Resolver
$ RUST_NS=std ./your-app
Since standard library resolver is not asynchronous we run resolver in a thread pool.
Parameters:
poll_ivl
-- polling interval for subscriptions in seconds, default1
threads
-- number of threads for name resolution, default4
Biggest declaration is something like this:
$ RUST_NS=std:poll_ivl=10:threads=16 ./your-app
License
Licensed under either of
- Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~6.5MB
~105K SLoC