Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.
/ dotenv Public archive

Based on GoDotEnv library, with type conversion function / 基于 GoDotEnv 开发的具有类型转换功能的环境配置库

License

Notifications You must be signed in to change notification settings

mix-go/dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenMix 出品:https://openmix.org

Mix Dotenv

基于 GoDotEnv 开发的具有类型转换功能的环境配置库

Based on GoDotEnv library, with type conversion function

Installation

go get github.com/mix-go/dotenv

Usage

载入 .env 到环境变量

_ = dotenv.Load(".env")

获取环境变量

i := dotenv.Getenv("key").String()
i := dotenv.Getenv("key").Bool()
i := dotenv.Getenv("key").Int64()
i := dotenv.Getenv("key").Float64()

设置默认值

i := dotenv.Getenv("key").String("default")
i := dotenv.Getenv("key").Bool(false)
i := dotenv.Getenv("key").Int64(123)
i := dotenv.Getenv("key").Float64(123.4)

License

Apache License Version 2.0, http://www.apache.org/licenses/

About

Based on GoDotEnv library, with type conversion function / 基于 GoDotEnv 开发的具有类型转换功能的环境配置库

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages