chore: allows dumping rendered templates using EVCC_TEMPLATE_RENDER=<template>

This commit is contained in:
andig 2024-08-12 13:35:50 +02:00
parent d4ecb4b2db
commit bfa9901cb8

View file

@ -3,6 +3,7 @@ package templates
import (
"errors"
"fmt"
"os"
"github.com/evcc-io/evcc/util"
"gopkg.in/yaml.v3"
@ -35,6 +36,10 @@ func RenderInstance(class Class, other map[string]interface{}) (*Instance, error
return nil, util.NewConfigError(err)
}
if os.Getenv("EVCC_TEMPLATE_RENDER") == cc.Template {
fmt.Println(string(b))
}
var instance Instance
if err := yaml.Unmarshal(b, &instance); err != nil {
return nil, fmt.Errorf("%w:\n%s", err, string(b))