mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
50 lines
801 B
Go
50 lines
801 B
Go
package dns
|
|
|
|
import (
|
|
"github.com/0xJacky/Nginx-UI/internal/cert/config"
|
|
"github.com/BurntSushi/toml"
|
|
"log"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func CheckIfErr(err error) {
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
}
|
|
|
|
func TestConfigEnv(t *testing.T) {
|
|
|
|
files, err := config.DistFS.ReadDir(".")
|
|
|
|
CheckIfErr(err)
|
|
|
|
for _, file := range files {
|
|
if filepath.Ext(file.Name()) != ".toml" {
|
|
continue
|
|
}
|
|
c := Config{}
|
|
|
|
_, err := toml.DecodeFS(config.DistFS, file.Name(), &c)
|
|
CheckIfErr(err)
|
|
|
|
log.Println(c.Name)
|
|
|
|
if c.Configuration != nil {
|
|
for k, v := range c.Configuration.Credentials {
|
|
log.Println(k, v)
|
|
}
|
|
|
|
for k, v := range c.Configuration.Additional {
|
|
log.Println(k, v)
|
|
}
|
|
}
|
|
|
|
if c.Links != nil {
|
|
log.Println(c.Links.API)
|
|
log.Println(c.Links.GoClient)
|
|
}
|
|
}
|
|
|
|
}
|