Skip to content

A Cangjie library to load environment variables from `.env`.

License

Notifications You must be signed in to change notification settings

gtn1024/cjdotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CjDotEnv

A Cangjie library to load environment variables from .env.

介绍 / Introduction

CjDotEnv is a Cangjie library to load environment variables from .env file.

CjDotEnv 是一个用来从 .env 文件中加载环境变量的仓颉库。

安装 / Installation

# In the `dependencies` section of `cjpm.toml`
cjdotenv = { git = "https://github.com/gtn1024/cjdotenv.git", tag = "0.1.0" }

使用 / Usage

# .env

# Database
DB_HOST=localhost
DB_USER=postgres
DB_PASS=123456
DB_DATABASE=postgres
import cjdotenv.load
import std.os.getEnv

main() {
    load()
    // or
    // load(".env")
    // load("path/to/.env")
    // load("one.env", "two.env", "three.env")

    println(getEnv("DB_HOST"))
    println(getEnv("DB_USER"))
    println(getEnv("DB_PASS"))
    println(getEnv("DB_DATABASE"))
}

QQ 群

欢迎加入 仓颉交流群(非官方):985038695

qqgroup

About

A Cangjie library to load environment variables from `.env`.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published