Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gtn1024/cjdotenv

A Cangjie library to load environment variables from `.env`.
https://github.com/gtn1024/cjdotenv

cangjie dotenv environment-variables

Last synced: 13 days ago
JSON representation

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

Awesome Lists containing this project

README

        


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

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

## 使用 / Usage

```shell
# .env

# Database
DB_HOST=localhost
DB_USER=postgres
DB_PASS=123456
DB_DATABASE=postgres
```

```cj
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](https://qm.qq.com/q/PcRbAUJSo0)

![qqgroup](./.github/qqgroup.jpg)