ch18.3
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"database/sql"
|
||||
"flag"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -45,6 +46,9 @@ type config struct {
|
||||
password string
|
||||
sender string
|
||||
}
|
||||
cors struct {
|
||||
trustedOrigins []string
|
||||
}
|
||||
}
|
||||
|
||||
func openDB(cfg config) (*sql.DB, error) {
|
||||
@@ -93,6 +97,11 @@ func main() {
|
||||
flag.StringVar(&cfg.smtp.password, "smtp-password", "d8672aa2264bb5", "SMTP password")
|
||||
flag.StringVar(&cfg.smtp.sender, "smtp-sender", "Greenlight <no-reply@greenlight.net", "SMTP sender")
|
||||
|
||||
flag.Func("cors-trusted-origins", "Trusted CORS origins (space separated)", func(s string) error {
|
||||
cfg.cors.trustedOrigins = strings.Fields(s)
|
||||
return nil
|
||||
})
|
||||
|
||||
flag.Parse()
|
||||
|
||||
logger := jsonlog.New(os.Stdout, jsonlog.LevelInfo)
|
||||
|
||||
Reference in New Issue
Block a user