2 unstable releases

0.2.0 Mar 28, 2024
0.1.0 Mar 13, 2024

#759 in Text processing

Download history 84/week @ 2024-03-07 44/week @ 2024-03-14 1/week @ 2024-03-21 167/week @ 2024-03-28 29/week @ 2024-04-04

196 downloads per month

MIT license

6KB
61 lines

env2toml

Convert env vars to toml text.

Latest version All downloads Downloads of latest version MIT License Github Tags Github Issues Build Status

Syntax

__ split to .

APP_TITLE='TOML Example'
APP_OWNER__NAME='Tom Preston-Werner'
APP_DATABASE__ENABLED=true
APP_DATABASE__PORTS='[ 8000, 8001, 8002 ]'
APP_SERVERS__ALPHA__IP=10.0.0.1
APP_SERVERS__ALPHA__ROLE=frontend
APP_SERVERS__BETA__IP=10.0.0.2
APP_SERVERS__BETA__ROLE=backend

PRIFIX: APP_

RESULT:

title="TOML Example" 

[owner]
name="Tom Preston-Werner" 

[database]
enabled=true 
ports=[ 8000, 8001, 8002 ] 

[servers]

[servers.alpha]
ip="10.0.0.1" 
role="frontend" 

[servers.beta]
ip="10.0.0.2" 
role="backend" 

Usage

use dotenvy;
use env2toml::env2toml;


fn main() {
    dotenvy::dotenv().ok();
    let result = env2toml("APP_").unwrap();
    println!("\n{}", result);
}

License

This project is licensed under the MIT license.

Dependencies

~0.6–1.2MB
~28K SLoC