You've already forked openaccounting-server
mirror of
https://github.com/openaccounting/oa-server.git
synced 2025-12-09 09:00:42 +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",
|
"WebUrl": "https://domain.com",
|
||||||
|
"Address": "",
|
||||||
"Port": 8080,
|
"Port": 8080,
|
||||||
"ApiPrefix": "",
|
"ApiPrefix": "",
|
||||||
"KeyFile": "",
|
"KeyFile": "",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package types
|
|||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
WebUrl string
|
WebUrl string
|
||||||
|
Address string
|
||||||
Port int
|
Port int
|
||||||
ApiPrefix string
|
ApiPrefix string
|
||||||
KeyFile string
|
KeyFile string
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.CertFile == "" || config.KeyFile == "" {
|
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 {
|
} 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()))
|
log.Fatal(fmt.Errorf("failed to start server with: %s", err.Error()))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user