Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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`.
- Host: GitHub
- URL: https://github.com/gtn1024/cjdotenv
- Owner: gtn1024
- License: mit
- Created: 2024-09-17T07:08:45.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2025-01-10T14:12:14.000Z (21 days ago)
- Last Synced: 2025-01-10T15:23:43.639Z (21 days ago)
- Topics: cangjie, dotenv, environment-variables
- Homepage:
- Size: 67.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.getEnvmain() {
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)