ch17
This commit is contained in:
@@ -26,12 +26,14 @@ type application struct {
|
||||
templateCache map[string]*template.Template
|
||||
formDecoder *form.Decoder
|
||||
sessionManager *scs.SessionManager
|
||||
debug bool
|
||||
}
|
||||
|
||||
type config struct {
|
||||
addr string
|
||||
staticDir string
|
||||
dsn string
|
||||
debug bool
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -39,6 +41,7 @@ func main() {
|
||||
flag.StringVar(&cfg.addr, "addr", ":4000", "HTTP network address")
|
||||
flag.StringVar(&cfg.staticDir, "static-dir", "./ui/static", "Path to static assets")
|
||||
flag.StringVar(&cfg.dsn, "dsn", "web:pass@/snippetbox?parseTime=true", "MySQL data source name")
|
||||
flag.BoolVar(&cfg.debug, "debug", false, "Option to enable debug mode")
|
||||
flag.Parse()
|
||||
|
||||
errorLog := log.New(os.Stderr, "ERROR\t", log.Ldate|log.Ltime|log.Lshortfile)
|
||||
@@ -68,6 +71,7 @@ func main() {
|
||||
templateCache: templateCache,
|
||||
formDecoder: formDecoder,
|
||||
sessionManager: sessionManager,
|
||||
debug: cfg.debug,
|
||||
}
|
||||
|
||||
tlsConfig := &tls.Config{
|
||||
|
||||
Reference in New Issue
Block a user