Skip to content

Commit

Permalink
fix: export dns api
Browse files Browse the repository at this point in the history
  • Loading branch information
pupilcc committed Jan 9, 2024
1 parent e27c29a commit f020bcf
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions middleware/acme.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ var usr, _ = user.Current()
func InitAcme() {
ca()
email()
export()
}

func ca() {
Expand Down Expand Up @@ -43,10 +42,10 @@ func email() {

func Issue(name string) {
logger := GetLogger()
produce := os.Getenv("ACME_PRODUCE")
dns := os.Getenv("ACME_DNS")
alias := os.Getenv("ACME_ALIAS")

cmd := exec.Command(filepath.Join(usr.HomeDir, ".acme.sh/acme.sh"), "--issue", "--dns", produce, "-d", name, "--challenge-alias", alias)
cmd := exec.Command(filepath.Join(usr.HomeDir, ".acme.sh/acme.sh"), "--issue", "--dns", dns, "-d", name, "--challenge-alias", alias)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stdout
err := cmd.Start()
Expand All @@ -65,16 +64,3 @@ func Install(name string, id string) {
logger.Error("cmd.Start() failed with %s\n", zap.String("error", err.Error()))
}
}

func export() {
logger := GetLogger()
account := os.Getenv("ACME_ACCOUNT")
token := os.Getenv("ACME_TOKEN")

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()))
}
}

0 comments on commit f020bcf

Please sign in to comment.