Skip to content

Commit

Permalink
fix: export set
Browse files Browse the repository at this point in the history
  • Loading branch information
pupilcc committed Jan 9, 2024
1 parent 93b5c7f commit e27c29a
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions middleware/acme.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package middleware

import (
"autossl/internal/service"
"bytes"
"go.uber.org/zap"
"os"
"os/exec"
Expand Down Expand Up @@ -72,19 +71,10 @@ func export() {
account := os.Getenv("ACME_ACCOUNT")
token := os.Getenv("ACME_TOKEN")

cmd := exec.Command("sh", "-c", "echo $CF_EMAIL && echo $CF_KEY")
cmd.Env = append(cmd.Env,
"CF_EMAIL="+account,
"CF_KEY="+token,
)
var out bytes.Buffer
cmd.Stdout = &out

cmd := exec.Command("sh", "-c", "echo $CF_Email && echo $CF_Key")
cmd.Env = []string{"CF_Email=" + account, "CF_Key=" + token}
err := cmd.Run()
if err != nil {
logger.Error("cmd.Start() failed with %s\n", zap.String("error", err.Error()))
return
}

logger.Info("Command %s", zap.String("Output:", out.String()))
}

0 comments on commit e27c29a

Please sign in to comment.