Browse Source

fix indentation

make_cert_optional
Otto Suess 7 years ago
parent
commit
ab51205dd2
No known key found for this signature in database GPG Key ID: 354749C62B4BAC41
  1. 34
      zapconnect.go

34
zapconnect.go

@ -1,16 +1,16 @@
package main
import (
"fmt"
"io/ioutil"
"github.com/Baozisoftware/qrcode-terminal-go"
"encoding/json"
b64 "encoding/base64"
"fmt"
"io/ioutil"
"github.com/Baozisoftware/qrcode-terminal-go"
"encoding/json"
b64 "encoding/base64"
)
type certificates struct {
Cert string `json:"c"`
Macaroon string `json:"m"`
Cert string `json:"c"`
Macaroon string `json:"m"`
}
func main() {
@ -18,21 +18,21 @@ func main() {
certBytes, err := ioutil.ReadFile(loadedConfig.TLSCertPath)
if err != nil {
fmt.Print(err)
}
fmt.Print(err)
}
macBytes, err := ioutil.ReadFile(loadedConfig.AdminMacPath)
macBytes, err := ioutil.ReadFile(loadedConfig.AdminMacPath)
if err != nil {
fmt.Print(err)
}
fmt.Print(err)
}
sEnc := b64.StdEncoding.EncodeToString([]byte(macBytes))
sEnc := b64.StdEncoding.EncodeToString([]byte(macBytes))
cert := &certificates{
Cert: string(certBytes),
Macaroon: sEnc}
certB, _ := json.Marshal(cert)
Cert: string(certBytes),
Macaroon: sEnc}
certB, _ := json.Marshal(cert)
obj := qrcodeTerminal.New()
obj := qrcodeTerminal.New()
obj.Get(string(certB)).Print()
}

Loading…
Cancel
Save