mirror of
https://github.com/KevinMidboe/traefik-etcd-advertiser.git
synced 2025-12-29 21:31:26 +00:00
init
This commit is contained in:
28
converter/yaml.go
Normal file
28
converter/yaml.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package converter
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/traefik/traefik/v3/pkg/config/dynamic"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func TraefikFromYaml(filePath string) (*dynamic.Configuration, error) {
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
var cfg dynamic.Configuration
|
||||
decoder := yaml.NewDecoder(file)
|
||||
if err := decoder.Decode(&cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &cfg, nil
|
||||
}
|
||||
|
||||
func TraefikToYaml(config *dynamic.Configuration) string {
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user