Add port option

This commit is contained in:
Andrea Fazzi 2020-02-25 13:50:48 +01:00
commit 3e3aef20c8
9 changed files with 15 additions and 7 deletions

View file

@ -11,4 +11,4 @@ WORKDIR /src/oef/
RUN go build -o oef *.go RUN go build -o oef *.go
ENTRYPOINT ["/src/oef/oef"] ENTRYPOINT ["/src/oef/oef"]
EXPOSE 3000 EXPOSE 80

View file

@ -1 +1 @@
0.4.2-11-g359f295-master 0.4.3-7-g38a4224-master

View file

@ -1,9 +1,13 @@
url: "https://gara.olimpiadi-economiaefinanza.it" url: "https://gara.olimpiadi-economiaefinanza.it"
port: "80"
domain: "olimpiadi-economiaefinanza.it" domain: "olimpiadi-economiaefinanza.it"
log_level: 2 log_level: 2
language: "it" language: "it"
jwt_expire_time: 120 jwt_expire_time: 120
handlers:
allow_session_url_query: true
keys: keys:
cookie_store_key: "2a=UvD!" cookie_store_key: "2a=UvD!"
jwt_signing_key: "ytOC>3," jwt_signing_key: "ytOC>3,"

View file

@ -1,4 +1,5 @@
url: "http://localhost:3000" url: "http://localhost:3000"
port: "3000"
log_level: 2 log_level: 2
language: "it" language: "it"
@ -28,4 +29,4 @@ smtp:
username: "" username: ""
password: "" password: ""
from: "no-reply@olimpiadi-economiaefinanza.it" from: "no-reply@olimpiadi-economiaefinanza.it"
bcc: "bcc@fake.org" bcc: "bcc@fake.org"

View file

@ -35,6 +35,7 @@ type ConfigT struct {
// Domain // Domain
Url string Url string
Port string
Domain string Domain string
// Language // Language

View file

@ -1,4 +1,5 @@
url: "http://localhost:3000" url: "http://localhost:3000"
port: "3000"
log_level: 2 log_level: 2
language: "it" language: "it"

View file

@ -1,4 +1,5 @@
url: "http://oef_regression_test:3000" url: "http://oef_regression_test"
port: "3000"
log_level: 2 log_level: 2
language: "it" language: "it"

View file

@ -1,4 +1,5 @@
url: "http://localhost:3000" url: "http://localhost:3000"
port: "3000"
log_level: 2 log_level: 2
language: "it" language: "it"
jwt_expire_time: 60 jwt_expire_time: 60

View file

@ -71,8 +71,6 @@ func main() {
defer profile.Start().Stop() defer profile.Start().Stop()
} }
log.Println("OEF is listening to port 3000...")
htmlRenderer, err := renderer.NewHTMLRenderer("templates") htmlRenderer, err := renderer.NewHTMLRenderer("templates")
if err != nil { if err != nil {
panic(err) panic(err)
@ -116,7 +114,8 @@ func main() {
conf.Handlers.PathPatterns = oef_handlers.DefaultPathPatterns conf.Handlers.PathPatterns = oef_handlers.DefaultPathPatterns
conf.Handlers.APIPathPatterns = oef_handlers.DefaultAPIPathPatterns conf.Handlers.APIPathPatterns = oef_handlers.DefaultAPIPathPatterns
if err := http.ListenAndServe(":3000", handlers.LoggingHandler(os.Stdout, oef_handlers.NewHandlers( log.Printf("OEF is listening to port %s...", conf.Port)
if err := http.ListenAndServe(":"+conf.Port, handlers.LoggingHandler(os.Stdout, oef_handlers.NewHandlers(
conf, conf,
renderer, renderer,
db, db,