Skip to content

Instantly share code, notes, and snippets.

@odeke-em
Created June 5, 2017 07:43
Show Gist options
  • Save odeke-em/30007ca77d4e025109a48d505456de05 to your computer and use it in GitHub Desktop.
Save odeke-em/30007ca77d4e025109a48d505456de05 to your computer and use it in GitHub Desktop.
HTTPS-ify darksi.de with frontender: generate a binary that could be uploaded directly to cloud storage then pulled and deployed on server
package main
import (
"io"
"log"
"os"
"github.com/orijtech/frontender"
)
func main() {
rc, err := frontender.GenerateBinary(&frontender.DeployInfo{
FrontendConfig: &frontender.Request{
Domains: []string{
"http://darksi.de/",
},
ProxyAddress: "http://192.168.1.105:9884",
},
TargetGOOS: "linux",
Environ: []string{"CGO_ENABLED=0"},
})
if err != nil {
log.Fatal(err)
}
defer rc.Close()
f, err := os.Create("darksi.de-binary")
if err != nil {
log.Fatal(err)
}
defer f.Close()
io.Copy(f, rc)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment