2024-03-13 14:10:15 +08:00
|
|
|
package viperx_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"code.yun.ink/pkg/viperx"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestViper(t *testing.T) {
|
|
|
|
|
var data Config
|
2024-03-13 14:27:42 +08:00
|
|
|
viperx.InitConfig("./config.yml", &data)
|
2024-03-13 14:10:15 +08:00
|
|
|
fmt.Println(data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
|
Name string `mapstructure:"name" json:"name" yaml:"name"`
|
|
|
|
|
}
|