cli/eebus: remove (BC) (#27157)
This commit is contained in:
parent
768656e0c3
commit
a613a46de1
1 changed files with 0 additions and 56 deletions
56
cmd/eebus.go
56
cmd/eebus.go
|
|
@ -1,56 +0,0 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
"github.com/Masterminds/sprig/v3"
|
||||
"github.com/evcc-io/evcc/server/eebus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// teslaCmd represents the vehicle command
|
||||
var eebusCmd = &cobra.Command{
|
||||
Use: "eebus-cert",
|
||||
Short: "Generate EEBUS certificate for using EEBUS compatible chargers",
|
||||
Run: runEEBUSCert,
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(eebusCmd)
|
||||
}
|
||||
|
||||
const tmpl = `
|
||||
Add the following to the evcc config file:
|
||||
|
||||
eebus:
|
||||
certificate:
|
||||
public: |
|
||||
{{ .public | indent 6 }}
|
||||
private: |
|
||||
{{ .private | indent 6 }}
|
||||
`
|
||||
|
||||
func generateEEBUSCert() {
|
||||
cert, err := eebus.CreateCertificate()
|
||||
if err != nil {
|
||||
log.FATAL.Fatal("could not create certificate", err)
|
||||
}
|
||||
|
||||
pubKey, privKey, err := eebus.GetX509KeyPair(cert)
|
||||
if err != nil {
|
||||
log.FATAL.Fatal("could not process generated certificate", err)
|
||||
}
|
||||
|
||||
t := template.Must(template.New("out").Funcs(sprig.FuncMap()).Parse(tmpl))
|
||||
if err := t.Execute(os.Stdout, map[string]any{
|
||||
"public": pubKey,
|
||||
"private": privKey,
|
||||
}); err != nil {
|
||||
log.FATAL.Fatal("rendering failed", err)
|
||||
}
|
||||
}
|
||||
|
||||
func runEEBUSCert(cmd *cobra.Command, args []string) {
|
||||
generateEEBUSCert()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue