1
0
mirror of https://github.com/writeas/htmlhouse synced 2025-07-18 21:08:16 +00:00

Use explicity host name, not given one

This commit is contained in:
Matt Baer 2016-01-02 16:23:31 -05:00
parent 1b2961c3a1
commit e083879b30
2 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,8 @@ type config struct {
PrivateKey string `env:"key=PRIVATE_KEY require=true"`
PublicKey string `env:"key=PUBLIC_KEY require=true"`
ServerPort int `env:"key=PORT default=8080"`
HostName string `env:"key=HOST default=https://html.house"`
ServerPort int `env:"key=PORT default=8080"`
AutoApprove bool `env:"key=AUTO_APPROVE default=false"`
AdminPass string `env:"key=ADMIN_PASS default=uhoh"`

View File

@ -39,7 +39,7 @@ func createHouse(app *app, w http.ResponseWriter, r *http.Request) error {
resUser := newSessionInfo(houseID)
if public {
go addPublicAccess(app, r.Host, houseID, html)
go addPublicAccess(app, houseID, html)
}
return impart.WriteSuccess(w, resUser, http.StatusCreated)
@ -72,7 +72,7 @@ func removePublicAccess(app *app, houseID string) error {
return nil
}
func addPublicAccess(app *app, host, houseID, html string) error {
func addPublicAccess(app *app, houseID, html string) error {
// Parse title of page
title := titleReg.FindStringSubmatch(html)[1]
if !validTitle(title) {
@ -87,7 +87,7 @@ func addPublicAccess(app *app, host, houseID, html string) error {
// Get thumbnail
data := url.Values{}
data.Set("url", fmt.Sprintf("%s/%s.html", host, houseID))
data.Set("url", fmt.Sprintf("%s/%s.html", app.cfg.HostName, houseID))
u, err := url.ParseRequestURI("http://peeper.html.house")
u.Path = "/"
@ -158,7 +158,7 @@ func renovateHouse(app *app, w http.ResponseWriter, r *http.Request) error {
resUser := newSessionInfo(houseID)
if public {
go addPublicAccess(app, r.Host, houseID, html)
go addPublicAccess(app, houseID, html)
} else {
go removePublicAccess(app, houseID)
}