AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
## Mix Dotenv 基于 [GoDotEnv](https://github.com/joho/godotenv) 开发的具有 **类型转换功能** 的环境配置库 Based on GoDotEnv library, with type conversion function ## Usage - 安装 ``` go get -u github.com/mix-go/dotenv ``` - 加载 `.env` 文件 不加载文件也可以获取系统环境变量,`Load` 方法并不是必须的 ~~~ err := dotenv.Load(".env") ~~~ - 获取环境配置 获取值 ~~~ dotenv.Getenv("key").String() dotenv.Getenv("key").Bool() dotenv.Getenv("key").Int64() dotenv.Getenv("key").Float64() ~~~ 获取值,当不存在时返回默认值 ~~~ dotenv.Getenv("key").String("default") dotenv.Getenv("key").Bool(false) dotenv.Getenv("key").Int64(123) dotenv.Getenv("key").Float64(123.4) ~~~ ## License Apache License Version 2.0, http://www.apache.org/licenses/