Changed HOST env var to DOMAIN

This commit is contained in:
Ross Trottier 2024-07-09 10:11:48 -06:00
parent 40d645859f
commit 54052434b4
2 changed files with 7 additions and 7 deletions

View File

@ -5,12 +5,12 @@ import (
)
func (app *application) home(writer http.ResponseWriter, request *http.Request) {
appLinks := getAppLinks(app.tier, app.host)
appLinks := getAppLinks(app.tier, app.domain)
data := templateData{
AppLinks: appLinks,
Tier: app.tier,
BaseUri: app.host,
BaseUri: app.domain,
}
app.render(writer, request, http.StatusOK, "home.tmpl.html", data)

View File

@ -11,7 +11,7 @@ type application struct {
logger *slog.Logger
templateCache map[string]*template.Template
tier string
host string
domain string
}
func main() {
@ -24,9 +24,9 @@ func main() {
if len(tier) == 0 {
tier = "starter"
}
host := os.Getenv("HOST")
if len(host) == 0 {
logger.Error("Must specify host name.")
domain := os.Getenv("DOMAIN")
if len(domain) == 0 {
logger.Error("Must specify domain name.")
os.Exit(1)
}
//Set up template cache
@ -40,7 +40,7 @@ func main() {
logger: logger,
templateCache: templateCache,
tier: tier,
host: host,
domain: domain,
}
err = http.ListenAndServe(":8080", app.routes())