env2toml

Crates.ioenv2toml
lib.rsenv2toml
version0.3.1
sourcesrc
created_at2024-03-13 12:25:37.479475
updated_at2024-12-09 12:58:17.060161
descriptionConvert env vars to toml text
homepage
repositoryhttps://github.com/mark0725/env2toml
max_upload_size
id1171661
size14,437
mark (mark0725)

documentation

README

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__PORT=3306
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
APP_USERS__0__NAME=USER0
APP_USERS__0__PASSWORD=u0
APP_USERS__1__NAME=USER1
APP_USERS__1__PASSWORD=u1

PRIFIX: APP_

RESULT:

title="TOML Example"
[owner]
name="Tom Preston-Werner"

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

[servers]

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

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

[[users]]
name="USER0"
password="u0"

[[users]]
name="USER1"
password="u1"

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.

Commit count: 0

cargo fmt