All Projects → leptonyu → salak.rs

leptonyu / salak.rs

Licence: MIT license
A multi layered configuration loader and zero-boilerplate configuration parser.

Programming Languages

rust
11053 projects
shell
77523 projects

Projects that are alternatives of or similar to salak.rs

environment
🌳 Environment variable configuration for Node.js made easy.
Stars: ✭ 12 (-55.56%)
Mutual labels:  config, environment, configuration, env
read-env
🔧 Transform environment variables into JSON object with sanitized values.
Stars: ✭ 60 (+122.22%)
Mutual labels:  config, configuration, env
env
A lightweight package for loading OS environment variables into structs for Go projects
Stars: ✭ 24 (-11.11%)
Mutual labels:  config, configuration, env
goodconf
Transparently load variables from environment or JSON/YAML file.
Stars: ✭ 80 (+196.3%)
Mutual labels:  config, configuration, env
Environ Config
Python Application Configuration With Environment Variables
Stars: ✭ 210 (+677.78%)
Mutual labels:  config, environment, configuration
cfg-rs
A Configuration Library for Rust Applications
Stars: ✭ 18 (-33.33%)
Mutual labels:  config, environment, configuration
dotfiles
My personal app/env configs and dotfiles.
Stars: ✭ 27 (+0%)
Mutual labels:  config, environment, configuration
Env
Simple lib to parse environment variables to structs
Stars: ✭ 2,164 (+7914.81%)
Mutual labels:  config, environment, configuration
Node Convict
Featureful configuration management library for Node.js
Stars: ✭ 1,855 (+6770.37%)
Mutual labels:  config, configuration, env
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+166.67%)
Mutual labels:  config, environment, env
betterconf
Minimalistic Python library for your configs.
Stars: ✭ 35 (+29.63%)
Mutual labels:  config, env
libconfini
Yet another INI parser
Stars: ✭ 106 (+292.59%)
Mutual labels:  config, configuration
javaproperties
Python library for reading & writing Java .properties files
Stars: ✭ 20 (-25.93%)
Mutual labels:  config, configuration
env-diff
Env-diff is a lightweight library which sync your .env files with .env.dist by composer scripts, hooks or manual running
Stars: ✭ 24 (-11.11%)
Mutual labels:  environment, env
logstash-config
logstash-config provides a parser and abstract syntax tree (AST) for the Logstash config format, written in Go
Stars: ✭ 26 (-3.7%)
Mutual labels:  config, configuration
Flex-AntiCheat
Flex AntiCheat - Optimized Configs For Multiple AntiCheats
Stars: ✭ 37 (+37.04%)
Mutual labels:  config, configuration
superconfig
Access environment variables. Also includes presence validation, type coercion and default values.
Stars: ✭ 33 (+22.22%)
Mutual labels:  config, configuration
nvim
❤️ A neovim config repo.
Stars: ✭ 33 (+22.22%)
Mutual labels:  config, configuration
dotfiles
Linux configuration files (dotfiles) and some useful scripts
Stars: ✭ 22 (-18.52%)
Mutual labels:  config, configuration
workbench
A hierarchical environment manager for bash, written in bash.
Stars: ✭ 17 (-37.04%)
Mutual labels:  environment, env

salak involve too many stuffs and confused names not only config, please use cfg-rs instead.

Salak is a multi layered configuration loader and zero-boilerplate configuration parser, with many predefined sources.

Crates.io Crates.io Documentation dependency status License Actions Status

Please refer to salak doc.

Notice

Please notice that salak-0.9.* is totally rewrited, so the APIs may changes much, and some functions may be removed. They will be added in later version.

Quick Example

use salak::*;

#[derive(Debug, FromEnvironment)]
#[salak(prefix = "config")]
struct Config {
    #[salak(default = false)]
    verbose: bool,
    optional: Option<String>,
    #[salak(name = "val")]
    value: i64,
}
let env = Salak::builder()
    .set("config.val", "2021")
    .build()
    .unwrap();
let config = env.get::<Config>().unwrap();
assert_eq!(2021, config.value);
assert_eq!(None, config.optional);
assert_eq!(false, config.verbose);

Trait FromEnvironment

Salak Factory

salak_factory can initialize resource based on salak, such as redis, postgresql, etc.

use std::sync::Arc;

use salak::*;
use salak_factory::redis_default::RedisPool;

generate_service!(RedisService {
  redis: RedisPool,
  #[salak(namespace = "hello", access = "pub")]
  back: Option<RedisPool>
});

fn main() -> Result<(), PropertyError> {
    env_logger::builder()
        .filter_level(log::LevelFilter::Info)
        .try_init()?;
    let env = Salak::builder()
        .register_default_resource::<RedisPool>()?
        .configure_args(app_info!())
        .build()?;
    let _service = env.get_service::<RedisService>()?;
    let _conn = _service.as_redis().get()?;
    Ok(())
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].