pathlib
, nothing new to remember.Thatlib has builtin support for Type-safe .env
. Type-safe .env
file is just a .env
but Typed.
Types are enforced via a comment, so it is still a "vanilla" .env
.
Type-safe .env
file can be used with unsafe .env
parsers, legacy parsers will ignore the comment.
Keys must be a non-empty ASCII string [a-zA-Z0-9_]
, keys are validated. Key-Value separator must be =
.
Parses the same .env
file from the vanilla implementation tests.
Several orders of magnitude faster than the vanilla implementation. Implementation is ~ 50 lines of code.
Examples:
# This is a comment
DB_HOST=localhost # string
DB_USER=root # string
DB_PASS="123" # string
DB_TIMEOUT=42 # int
DELAY=3.14 # float
ACTIVE=true # bool
.env
file example https://github.com/juancarlospaco/thatlib/blob/nim/examples/.env
BEP20 Binance Smart Chain Network BSC
0xb78c4cf63274bb22f83481986157d234105ac17e
BTC Bitcoin Network
1Pnf45MgGgY32X4KDNJbutnpx96E4FxqVi
Lightning Network
[email protected]
BEP20 Binance Smart Chain Network BSC
0xb78c4cf63274bb22f83481986157d234105ac17e
ERC20 Ethereum Network
0xb78c4cf63274bb22f83481986157d234105ac17e
BEP20 Binance Smart Chain Network BSC
0xb78c4cf63274bb22f83481986157d234105ac17e
ERC20 Ethereum Network
0xb78c4cf63274bb22f83481986157d234105ac17e
TRC20 Tron Network
TWGft53WgWvH2mnqR8ZUXq1GD8M4gZ4Yfu
BEP20 Binance Smart Chain Network BSC
0xb78c4cf63274bb22f83481986157d234105ac17e
SOL Solana Network
FKaPSd8kTUpH7Q76d77toy1jjPGpZSxR4xbhQHyCMSGq
BEP20 Binance Smart Chain Network BSC
0xb78c4cf63274bb22f83481986157d234105ac17e
ADA Cardano Network
DdzFFzCqrht9Y1r4Yx7ouqG9yJNWeXFt69xavLdaeXdu4cQi2yXgNWagzh52o9k9YRh3ussHnBnDrg7v7W2hSXWXfBhbo2ooUKRFMieM
ERC20 Ethereum Network
0xb78c4cf63274bb22f83481986157d234105ac17e
ALGO Algorand Network
WM54DHVZQIQDVTHMPOH6FEZ4U2AU3OBPGAFTHSCYWMFE7ETKCUUOYAW24Q
DOT Network
13GdxHQbQA1K6i7Ctf781nQkhQhoVhGgUnrjn9EvcJnYWCEd
BEP20 Binance Smart Chain Network BSC
0xb78c4cf63274bb22f83481986157d234105ac17e
https://pay.binance.com/en/checkout/e92e536210fd4f62b426ea7ee65b49c3
⭐ @juancarlospaco ⭐ @hamidb80 ⭐ @nikitavoloboev ⭐ @mxschmitt ⭐ @harrtho ⭐ @kangkot ⭐ @crox-safe ⭐ @carno ⭐ @xdroff ⭐ @tumregels ⭐ @Pebaz ⭐ @Siss3l ⭐ @daweedkob ⭐ @xilicode ⭐ @pietroppeter ⭐ @linwaytin ⭐ @thomas-mckay ⭐ @hansalemaos ⭐ @benzolium ⭐ @T145 ⭐ @Xynonners ⭐ @BlackNurse ⭐ @xjzh123 ⭐ @JoeBarouneD