file-json

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

README

File + JSON 配置示例

演示如何使用配置库加载 JSON 配置文件。

文件

  • config.json - 示例 JSON 配置文件,支持环境变量替换
  • main.go - 简单的配置加载示例

运行示例

cd examples/file-json
go run main.go

注意:示例中使用绝对路径,实际使用时可根据需要调整路径。

环境变量支持

配置文件支持环境变量替换:

export HOST=127.0.0.1
export PORT=9000
export DEBUG=true
go run main.go

输出示例

Server: localhost:8080 (debug: false)
Database: sqlite:///app.db (max_conn: 10)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL