You've already forked openaccounting-server
mirror of
https://github.com/openaccounting/oa-server.git
synced 2025-12-09 00:50:59 +13:00
Added Config.Address to allow the server to bind to a different IP address
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"WebUrl": "https://domain.com",
|
||||
"Address": "",
|
||||
"Port": 8080,
|
||||
"ApiPrefix": "",
|
||||
"KeyFile": "",
|
||||
|
||||
@@ -2,6 +2,7 @@ package types
|
||||
|
||||
type Config struct {
|
||||
WebUrl string
|
||||
Address string
|
||||
Port int
|
||||
ApiPrefix string
|
||||
KeyFile string
|
||||
|
||||
@@ -48,9 +48,9 @@ func main() {
|
||||
}
|
||||
|
||||
if config.CertFile == "" || config.KeyFile == "" {
|
||||
err = http.ListenAndServe(":"+strconv.Itoa(config.Port), app.MakeHandler())
|
||||
err = http.ListenAndServe(config.Address+":"+strconv.Itoa(config.Port), app.MakeHandler())
|
||||
} else {
|
||||
err = http.ListenAndServeTLS(":"+strconv.Itoa(config.Port), config.CertFile, config.KeyFile, app.MakeHandler())
|
||||
err = http.ListenAndServeTLS(config.Address+":"+strconv.Itoa(config.Port), config.CertFile, config.KeyFile, app.MakeHandler())
|
||||
}
|
||||
log.Fatal(fmt.Errorf("failed to start server with: %s", err.Error()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user