1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

api: add COMMENTO_BIND_ADDRESS variable

Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com>
This commit is contained in:
Pierre-Alain TORET
2018-06-09 23:19:19 +02:00
committed by daftaupe
parent 684734cb29
commit 73d04bf857
3 changed files with 22 additions and 2 deletions

View File

@ -22,8 +22,10 @@ func serveRoutes() error {
headers := handlers.AllowedHeaders([]string{"X-Requested-With"})
methods := handlers.AllowedMethods([]string{"GET", "POST"})
logger.Infof("starting server on port %s\n", os.Getenv("PORT"))
if err := http.ListenAndServe(":"+os.Getenv("PORT"), handlers.CORS(origins, headers, methods)(router)); err != nil {
addrPort := os.Getenv("BIND_ADDRESS") + ":" + os.Getenv("PORT")
logger.Infof("starting server on %s\n", addrPort)
if err := http.ListenAndServe(addrPort, handlers.CORS(origins, headers, methods)(router)); err != nil {
logger.Errorf("cannot start server: %v", err)
return err
}