hxenv

This library will allow parsing of .ENV files
https://github.com/MonekyTheShep/HxEnv

To install, run:

haxelib install hxenv 1.0.1 

See using Haxelib in Haxelib documentation for more information.

README.md

HxEnv

.ENV File Parser which supports multi line and variable interpolation.

Variable Interpolation using ${}

KEY=VALUE
KEY2=${KEY}

Multi Line using Double Quotes.

KEY="THIS IS
MULTI LINE SUPPORT"

"example.env" File

KEY=VALUE

Modify or Access Existing Env Files

var content:String = File.getContent("example.env");
var parser:Parser = new Parser();

var env:Env = parser.parseString(content);

// returns the value of a key
trace(env.get("KEY")); // VALUE

var string:String = env.toString();

var out = File.write("exampleout.env");
        
try {
    out.writeString(string);

    out.flush();
    out.close();
} 
catch (e:Dynamic) {
    trace("Error: " + e);
}

Create Env Files


var env = new Env();

env.set("KEY", "VALUE", DoubleQuote);
env.addComment("Comment");
env.get("KEY"); // VALUE

var string:String = env.toString(); // output serialised env

var out = File.write("exampleout.env");
        
try {
    out.writeString(string);

    out.flush();
    out.close();
} 
catch (e:Dynamic) {
    trace("Error: " + e);
}
Contributors
MonekyTheShep
Version
1.0.1
Published
3 months ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub