mirror of
https://github.com/KevinMidboe/traefik-etcd-advertiser.git
synced 2025-10-29 18:00:19 +00:00
init
This commit is contained in:
18
converter/json.go
Normal file
18
converter/json.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package converter
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
|
||||
"github.com/traefik/traefik/v3/pkg/config/dynamic"
|
||||
)
|
||||
|
||||
func TraefikToJSON(config *dynamic.Configuration) map[string]interface{} {
|
||||
var data map[string]interface{}
|
||||
jsonData, _ := json.Marshal(config)
|
||||
if err := json.Unmarshal(jsonData, &data); err != nil {
|
||||
log.Printf("failed to unmarshal JSON: %w", err)
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user