Changed HOST env var to DOMAIN
This commit is contained in:
parent
40d645859f
commit
54052434b4
@ -5,12 +5,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (app *application) home(writer http.ResponseWriter, request *http.Request) {
|
func (app *application) home(writer http.ResponseWriter, request *http.Request) {
|
||||||
appLinks := getAppLinks(app.tier, app.host)
|
appLinks := getAppLinks(app.tier, app.domain)
|
||||||
|
|
||||||
data := templateData{
|
data := templateData{
|
||||||
AppLinks: appLinks,
|
AppLinks: appLinks,
|
||||||
Tier: app.tier,
|
Tier: app.tier,
|
||||||
BaseUri: app.host,
|
BaseUri: app.domain,
|
||||||
}
|
}
|
||||||
|
|
||||||
app.render(writer, request, http.StatusOK, "home.tmpl.html", data)
|
app.render(writer, request, http.StatusOK, "home.tmpl.html", data)
|
||||||
|
@ -11,7 +11,7 @@ type application struct {
|
|||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
templateCache map[string]*template.Template
|
templateCache map[string]*template.Template
|
||||||
tier string
|
tier string
|
||||||
host string
|
domain string
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -24,9 +24,9 @@ func main() {
|
|||||||
if len(tier) == 0 {
|
if len(tier) == 0 {
|
||||||
tier = "starter"
|
tier = "starter"
|
||||||
}
|
}
|
||||||
host := os.Getenv("HOST")
|
domain := os.Getenv("DOMAIN")
|
||||||
if len(host) == 0 {
|
if len(domain) == 0 {
|
||||||
logger.Error("Must specify host name.")
|
logger.Error("Must specify domain name.")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
//Set up template cache
|
//Set up template cache
|
||||||
@ -40,7 +40,7 @@ func main() {
|
|||||||
logger: logger,
|
logger: logger,
|
||||||
templateCache: templateCache,
|
templateCache: templateCache,
|
||||||
tier: tier,
|
tier: tier,
|
||||||
host: host,
|
domain: domain,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = http.ListenAndServe(":8080", app.routes())
|
err = http.ListenAndServe(":8080", app.routes())
|
||||||
|
Loading…
Reference in New Issue
Block a user