add https
This commit is contained in:
parent
6fb35315fc
commit
cb1af81da7
|
@ -26,8 +26,9 @@ func main() {
|
|||
fmt.Println("PLANNER_API_KEY is empty")
|
||||
os.Exit(1)
|
||||
}
|
||||
crtPath := os.Getenv("PLANNER_CRT_PATH")
|
||||
keyPath := os.Getenv("PLANNER_KEY_PATH")
|
||||
|
||||
//mem := NewMemory()
|
||||
repo, err := NewSqlite(dbPath)
|
||||
if err != nil {
|
||||
fmt.Printf("could not open sqlite db: %s", err.Error())
|
||||
|
@ -36,7 +37,13 @@ func main() {
|
|||
|
||||
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||
|
||||
go http.ListenAndServe(fmt.Sprintf(":%d", port), NewServer(repo, apiKey, logger))
|
||||
address := fmt.Sprintf(":%d", port)
|
||||
srv := NewServer(repo, apiKey, logger)
|
||||
if crtPath != "" || keyPath != "" {
|
||||
go http.ListenAndServeTLS(address, crtPath, keyPath, srv)
|
||||
} else {
|
||||
go http.ListenAndServe(address, srv)
|
||||
}
|
||||
|
||||
logger.Info("service started")
|
||||
|
||||
|
|
Loading…
Reference in New Issue