Skip to content

Commit 99f82d2

Browse files
authored
Merge pull request NdoleStudio#129 from eriksson/use_env_api_host_api_port
Enable binding the API server to specific interface and port using environment variables
2 parents baf229a + b3c2181 commit 99f82d2

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

api/.env.production

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SMTP_PORT=
2020

2121
APP_URL=
2222
APP_NAME=
23-
APP_LOGO_URL=
23+
APP_PORT=8000
24+
APP_HOST=0.0.0.0
2425

25-
DATABASE_URL
26+
DATABASE_URL=

api/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"os"
5-
5+
"fmt"
66
_ "github.com/NdoleStudio/httpsms/docs"
77
"github.com/NdoleStudio/httpsms/pkg/di"
88
)
@@ -33,5 +33,5 @@ func main() {
3333
}
3434

3535
container := di.NewContainer("http-sms", Version)
36-
container.Logger().Info(container.App().Listen(":8000").Error())
36+
container.Logger().Info(container.App().Listen(fmt.Sprintf("%s:%s", os.Getenv("APP_HOST"), os.Getenv("APP_PORT"))).Error())
3737
}

0 commit comments

Comments
 (0)